Page 1 of 1

call to mail() doesn't work in Windows

Posted: Mon Dec 19, 2005 2:06 pm
by jasongr
Hello people

I am using the following code to try to send an email:

Code: Select all

$to = "test@test.com";
$subject = "This is a test";
$message = "This is the message body";
$header = "From: John Smith <johnsmith@test.com>";
mail($to, $subject, $message, $header);
This code works fine when I run it on a Linux machine.
It does not work when I try it on a Windows machine

I have SMTP server installed

Is there something wrong in the mail format? including the body and the headers for Windows?

any help would be appreciated

Posted: Mon Dec 19, 2005 2:25 pm
by Burrito
can you send mail through the smtp server from a mail client?

in other words, are you sure the smtp server works?

Posted: Mon Dec 19, 2005 2:35 pm
by Chris Corbyn
.... and have you got full error reporting on, including notices?

Posted: Tue Dec 20, 2005 1:48 am
by jasongr
I was able to get it to work by modifying the header to

Code: Select all

$header = "From: johnsmith@test.com";
Appearantly there is a problem with the first and last name and the usage of <>