"Brad Esclavon" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > I have made a simple script to mail an email to a person on my domain. i > have tested the script with different values and i still cannot get the > email. when i execute the mail function, it returns true, so i know it gets > to the mail server, but the mail server doesnt actually send it. i am being > hosted by a company and am sure the mail server is up and working for me. is > there a way i need to feed it a username/password with php? any ideas on why > its not working? im completely stumped. > > <?php > > ini_set("SMTP","smtp-relay.affinity.com"); > > $mail_to = "[EMAIL PROTECTED]"; > $mail_from = "[EMAIL PROTECTED]"; > $mail_subject = "php mail test"; > $mail_body = "test"; > > if ( mail($mail_to, $mail_subject, $mail_body)) > {echo("sucess");} > else > {echo("fail");} > > ?> Brad, you're missing a buch of headers probably causing your email to be dropped somewhere regarded spam (especially Hotmail is quite picky about the headers).
Try and send these headers (fourth argument in mail() function. $headers = "MIME-Version: 1.0\r\n"; $headers .= "Content-Type: text/plain; charset=iso-8859-1\r\n"; $headers .= "X-Priority: 3\r\n"; $headers .= "X-MSMail-Priority: Normal\r\n"; $headers .= "X-Mailer: PHP/".phpversion()."\r\n"; //I use this, I'm not sure if you really need this header $headers .= "From: [EMAIL PROTECTED]"; $headers .= "Reply-to: [EMAIL PROTECTED]"; $headers .= "Return-path: [EMAIL PROTECTED]"; $headers .= "Error-to: [EMAIL PROTECTED]"; if (mail($mail_to, $mail_subject, $mail_body,$headers)) { echo ("success"); } else { echo ("failed"); } HTH, -- Ivo Fokkema PHP & MySQL programmer Leiden University Medical Centre Netherlands -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php