Forum Moderators: phranque
If you're hosted on a Windows box, things will look different. I'm not familiar with any standard mail injection mechanisms there, if those even exist. If you don't find anything, using a SMTP server might indeed be an option. But then, that doesn't necessarily have to be one you run yourself, not even one run by your hosting provider.
In other words, your problem will be easier to solve when you tell us a little more about the infrastructure you have at your disposal... ;)
To: "Some one" <someone@example.com>
From: "My Self" <myself@example.com>
Return-Path: "My Self" <myself@example.com>this is the message
text that may or may not go
over several lines
Then invoke "/usr/sbin/sendmail -t", probably with whatever implementation of popen you have available in Perl, and feed it the above message on stdin. The first empty line in the data stream seperates the headers from the message text (you could add other headers like CC: or BCC: if you need to). The "-t" option to sendmail tells it to take the recipients and sender addresses from the headers in the data. In pseudocode (or Python), a working procedure would look like this:
def send_with_sendmail(recipient, sender, msg):
f = os.popen("/usr/sbin/sendmail -t", "w")
f.write("To: " + recipient + "\n")
f.write("From: " + sender + "\n")
f.write("Return-Path: " + sender + "\n")
f.write("\n")
f.write(msg)
f.write("\n")
f.close()