Sending mail (1)

Try online Examples

You might think that sending an e-mail involves a lot of coding...
Think again!
For this example to work, you need to be connected to the Internet.
Very importantly you also need to know an SMTP server that will trust you.
If you're working from home, you'll find the address of your SMTP server in the settings of your e-mail program.
Most SMTP servers are now more careful about who they accept connections from due to much abuse having been perpetrated by spammers.

See sendMail for more details.

Here's what the HTML looks like:

	<FORM action="!(_AptilisURL)" method="POST">
	<INPUT type="hidden" name="file" value="!(_ScriptsRepository)sender1.e.txt">

	Your e-mail address:<BR>
	<INPUT type="text" name="from" size=40><BR>
	<BR>
	Your message:<BR>
	<TEXTAREA name="message" cols=40 rows=5></TEXTAREA><BR>

	<INPUT type="submit" value="Send Message">
	</FORM>

And now, the Aptilis programme, sender1.e.txt:

sub main

	print("Content-type: text/html\n\n")

	// The value I use here for my SMTP server probably wont work for you.
	// Ask your ISP or your System administrator for an SMTP server to use.

	setSMTPServer("smtp.ntlworld.com")

	print("<HTML>\n<BODY>\n\n")

	sendmail("nirvana@aptilis.com", from$, "Aptilis e-mail example", message$)
	print("Your message has been sent!")

	print("<BODY>\n</HTML>")

end main

Things learnt