Nexus10 Posted July 12, 2010 Share Posted July 12, 2010 Messages sent using the php mail function on my webhost's server appear on the email's sent to the user that it was mailed by/from 'sererXXX.mywebhost.com'. Is there a way to hide this/change this so that the user does not know who my hosting providor is (a possible security exception in my opinion I think). Quote Link to comment https://forums.phpfreaks.com/topic/207485-php-mail/ Share on other sites More sharing options...
themistral Posted July 12, 2010 Share Posted July 12, 2010 Have you specified who the mail is from? $headers .= 'From'; mail($to, $subject, $body, $headers); Quote Link to comment https://forums.phpfreaks.com/topic/207485-php-mail/#findComment-1084776 Share on other sites More sharing options...
Nexus10 Posted July 12, 2010 Author Share Posted July 12, 2010 Yeah, I've specified that. The email the user receives does say its from 'my email address', but it also says in the email details the name of my webhost which mailed it. Quote Link to comment https://forums.phpfreaks.com/topic/207485-php-mail/#findComment-1084778 Share on other sites More sharing options...
themistral Posted July 12, 2010 Share Posted July 12, 2010 Could you post your code? Quote Link to comment https://forums.phpfreaks.com/topic/207485-php-mail/#findComment-1084779 Share on other sites More sharing options...
Nexus10 Posted July 12, 2010 Author Share Posted July 12, 2010 $to = $email; $subject = "Account Verification"; $header = "from: NexusIndustry <[email protected]>"; $message = "Your confirmation link: \r\n"; $message .= "Click on this link (or copy and paste into the address bar) to activate your account \r\n"; $message .= "http://www.nexusindustry.com/admin/confirm.php?passkey=$email_auth"; $sentmail = mail($to, $subject, $message, $header); Quote Link to comment https://forums.phpfreaks.com/topic/207485-php-mail/#findComment-1084782 Share on other sites More sharing options...
themistral Posted July 12, 2010 Share Posted July 12, 2010 Your script works fine for me. Maybe it's a server setting somewhere? Quote Link to comment https://forums.phpfreaks.com/topic/207485-php-mail/#findComment-1084784 Share on other sites More sharing options...
myrddinwylt Posted July 12, 2010 Share Posted July 12, 2010 Just use PHP Mailer, and authenticate with your mail server before sending messages. This would eliminate the erronious e-mail account from showing up. Yes, it's more complicated to use PHP Mailer, but it's more accurate, and ensures that every message sent from you is coming from you. I can not believe how many programs are created with this design flaw, and I really wish PHP would either toss the command or update it to allow for: Authentication POP before SMTP SSL / TLS In script configuration CC/BCC/etc HTML/Plain combination body text MIME IMAP Support Rather than monkeying about with headers, and still don't have several of the above features, such as POP before SMTP, or SSL/TLS. Just wish that developers would stop being so lazy with this area if they wish to distribute/sell the application. (not saying thats what you are doing here, but since I have signed up, you are around the 12th person who is using mail() ..... i know it's easier, but it really does create a lot of headaches -- aka... your host e-mail account showing up as originator e-mail in the header, automatically ending up in anyones spam box who uses a server that checks if your account was authenticated with your server frst -- direct mail is 99% of the time spam). Hope this helps you anyway. Quote Link to comment https://forums.phpfreaks.com/topic/207485-php-mail/#findComment-1084786 Share on other sites More sharing options...
kenrbnsn Posted July 12, 2010 Share Posted July 12, 2010 Using the standard PHP mail function is fine if you're sending plain TEXT email and you don't need much customization. I agree that you should use the PHPMailer class if you want to send HTML mail or need to customize the headers. If you don't want to use the PHPMailer class, try using the 5th parameter to the mail() function where you can specify other headers. Change <?php $sentmail = mail($to, $subject, $message, $header); ?> to <?php $sentmail = mail($to, $subject, $message, $header,'-f [email protected]'); ?> Ken Quote Link to comment https://forums.phpfreaks.com/topic/207485-php-mail/#findComment-1084860 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.