View Single Post
Old 03-18-2004, 12:20 AM   #3 (permalink)
Epsilon
Regular Contributor
 
Epsilon's Avatar
 
Join Date: Mar 2003
Location: Las Vegas, NV
Posts: 127
Epsilon is on a distinguished road
Well, after a lot more reading and searching and trial and error I figured it out.
Code:
ini_set("SMTP","mail.domain.com");
ini_set("sendmail_from","user@domain.com");

if (mail("me@mydomain.com","This is a test","This is the body","From: user@domain.com\r\nContent-type: text/plain\r\n\r\n"))
{
print "Success";
}
else
{
print "Failed";
}
They require you to specify the SMTP server AND a valid From address for the domain, and the 'From:' setting in the header isn't good enough. You have to use ini_set() for both.

IMO as a programmer I think this is a load of BS. Basically the web host is forcing me to use ini_set() to override both of these settings during runtime of the script because they intentionally set them incorrectly in their php.ini file. Apparently they feel this gives them better security with regard to spammers. Maybe so, but I spent about 6 hours troubleshooting it and no one in their tech department could figure out what the problem was. I ended up stumbling upon the solution through trial and error.

Virtual hosting sucks, and Windows servers suck. And the two of them together are a catastrophe. Just my opinion.
__________________
--Epsilon--
Epsilon is offline   Reply With Quote