project3 Posted February 14, 2008 Share Posted February 14, 2008 What am I doing wrong here its on a windows server. mail("$email", "Web Site Question", "test", "From: $name <$email>"); doesn't work mail("$email", "Web Site Question", "test", "From: $email"); works just fine I really need the from name to work. Quote Link to comment https://forums.phpfreaks.com/topic/91171-php-mail-from-name-not-working-on-windows-server/ Share on other sites More sharing options...
sKunKbad Posted February 15, 2008 Share Posted February 15, 2008 I can't tell you why your From name doesn't work. When I was using a windows server to send mail, I had to use: ini_set("SMTP","mail.yourdomain.com"); ini_set("smtp_port","25"); The standard format for sending mail through php's mail function is: $to = $email; $subject = 'This is email, duh'; $message = 'I want to go home.'; $headers = "From: me <me@bored.com>\r\nReply-To: me@bored.com\r\nReturn-Path: ime@bored.com"; mail( $to, $subject, $message, $headers ); Quote Link to comment https://forums.phpfreaks.com/topic/91171-php-mail-from-name-not-working-on-windows-server/#findComment-467263 Share on other sites More sharing options...
haku Posted February 15, 2008 Share Posted February 15, 2008 My server requires that the 'from' address be an existing address (on my server) for the from name to work. If I try to use an address that doesn't exist, or one that is not on my server, the actual address comes through instead. Maybe your host is set up the same way. So if the from email address in question doesn't exist, then try creating it and then sending the mail again and seeing what happens. Quote Link to comment https://forums.phpfreaks.com/topic/91171-php-mail-from-name-not-working-on-windows-server/#findComment-467325 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.