View Single Post
Old 03-17-2004, 05:01 PM   #1 (permalink)
Epsilon
Regular Contributor
 
Epsilon's Avatar
 
Join Date: Mar 2003
Location: Las Vegas, NV
Posts: 127
Epsilon is on a distinguished road
Specifying SMTP server for PHP mail()

I'm writing a script for use on a Windows web server and I can't get it to send mail. The host says you have to specify the SMTP server for the domain name, but in all the docs I've looked at I can't figure out the right syntax.

Here's my test script:
Code:
ini_set("SMTP","mail.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";
}
I've tried several things, but no luck. All the PHP documentation I can find talks about setting the SMTP server in php.ini, which makes perfect sense, but this is a virtual hosting account and I can't modify php.ini. There has to be some way to set it in the script.

Has anyone had luck using mail() on Windows?
__________________
--Epsilon--
Epsilon is offline   Reply With Quote