EchoFool Posted January 22, 2010 Share Posted January 22, 2010 Hey When ever i send my mail from a php mail function i get "unknown sender" in my gmail account but i clearly put who it was from in my headers and subject is also filled in yet subject doesn't come through either... my mail function is simple like this: // Send the email. $Email = $Var; $subject = 'Reminder'; $headers = 'From: My only server!'; $message = 'I am sending you a reminder! '; mail($Email, $subject, $message, $headers); What am i doing wrong ? Quote Link to comment https://forums.phpfreaks.com/topic/189407-email-unknown-sending-s/ Share on other sites More sharing options...
rajeevbharti Posted January 22, 2010 Share Posted January 22, 2010 dear friend you try like this i hope it will work <?php $to = '[email protected]'; $subject = 'the subject'; $message = 'hello'; $headers = 'From: [email protected]' . "\r\n" . 'Reply-To: [email protected]' . "\r\n" . 'X-Mailer: PHP/' . phpversion(); mail($to, $subject, $message, $headers); ?> Quote Link to comment https://forums.phpfreaks.com/topic/189407-email-unknown-sending-s/#findComment-999791 Share on other sites More sharing options...
oni-kun Posted January 22, 2010 Share Posted January 22, 2010 what am i doing wrong? Yes, you are not sending the from address, is it supposed to appear there? As well, you should set the MIME header to prevent spam traps and allow html if you wish so. $headers .= 'MIME-Version: 1.0' . "\n"; $headers .= 'Content-type: text/html; charset=UTF-8' . "\r\n"; Quote Link to comment https://forums.phpfreaks.com/topic/189407-email-unknown-sending-s/#findComment-999798 Share on other sites More sharing options...
EchoFool Posted January 22, 2010 Author Share Posted January 22, 2010 No i didn't want to send a server email as i aint set up emails from my server. Quote Link to comment https://forums.phpfreaks.com/topic/189407-email-unknown-sending-s/#findComment-999991 Share on other sites More sharing options...
PFMaBiSmAd Posted January 22, 2010 Share Posted January 22, 2010 The From: header must be a valid email address at the sending mail server. You are lucky that your mail server even sent it or that the gmail server accepted it. If you want to send directly to your gmail mailbox, you will need to use SMTP authentication, which the php mail() function does not support. You would need to use one of the many php mailer classes. Quote Link to comment https://forums.phpfreaks.com/topic/189407-email-unknown-sending-s/#findComment-999993 Share on other sites More sharing options...
EchoFool Posted January 22, 2010 Author Share Posted January 22, 2010 Which is the best mail function to use then ? And that might explain why people don't get my activation emails Quote Link to comment https://forums.phpfreaks.com/topic/189407-email-unknown-sending-s/#findComment-999994 Share on other sites More sharing options...
PFMaBiSmAd Posted January 22, 2010 Share Posted January 22, 2010 What problem are you trying to solve? Sending an email directly to your own mailbox at an ISP without using your web host's mail server or sending emails to any arbitrary email address that visitors to your site have provided and if so, what email server do you want to use as the sending mail server? Quote Link to comment https://forums.phpfreaks.com/topic/189407-email-unknown-sending-s/#findComment-999996 Share on other sites More sharing options...
EchoFool Posted January 22, 2010 Author Share Posted January 22, 2010 The latter one and currently i just been using mail function to send them i didn't know it get any more in depth than that =/ Quote Link to comment https://forums.phpfreaks.com/topic/189407-email-unknown-sending-s/#findComment-1000026 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.