Fairly simple - for example:
I've a script that runs on my website and lets me know when someone leaves me a comment. So, in my AddComment script, there's
# Hijack the server's sendmail to send an email
MAIL = "/usr/sbin/sendmail"
# get the email message from a file
f = open('emailtext', 'r')
message = f.read()
#Let myself know the updated URL
message = message + "\nhttp://www.cybermenology.com/Comments/" + filename
# open a pipe to the mail program and
# write the data to the pipe
p = os.popen("%s -t" % MAIL, 'w')
#Surprisingly enough, I don't really care what the exit code of the write() is.
# print "Exit code: %s" % exitcode
The syntax for opening a system pipe may differ slightly depending on what language you're using. The above is python
The actual text file containing the mail headers and the basic message is:
And that's all there is to it.