Skip to main content

How to use smtp function in php with authentication

Comments

6 comments

  • cPanelMichael
    Hello, It's likely the issue is that Hotmail isn't accepting the message because the form you referenced doesn't use SMTP authentication (it looks to use the PHP mail function). Your web hosting provider could review the Exim logs to confirm if that's the case. We don't offer help with coding, but you may want to check with a website such as StackOverflow for help developing a PHP form that uses SMTP authentication. EX: Need SMTP authentication in my PHP form? Thank you.
    0
  • rpvw
    By far the best way to fix this is what cPanelMichael instructed you to do in the previous post. If you want to try something that is a lot easier (but is not guaranteed to work with Hotmail - you will have to experiment) Add the fifth parameter to your mail() line something like[php]mail($to, $subject, $formcontent, $mailheader, "-f you@yourdomain.com") or die("Error!");[/php] or you could try [php]mail($to, $subject, $formcontent, $mailheader, "-f" .$email) or die("Error!");[/php] I think you will get the best results by using a -f parameter that matches the same domain on the server that is executing the mail() function. See the PHP manual for full details PHP: mail - Manual
    0
  • Webnook
    By far the best way to fix this is what cPanelMichael instructed you to do in the previous post. If you want to try something that is a lot easier (but is not guaranteed to work with Hotmail - you will have to experiment) Add the fifth parameter to your mail() line something like[php]mail($to, $subject, $formcontent, $mailheader, "-f you@yourdomain.com") or die("Error!");[/php] or you could try [php]mail($to, $subject, $formcontent, $mailheader, "-f" .$email) or die("Error!");[/php] I think you will get the best results by using a -f parameter that matches the same domain on the server that is executing the mail() function. See the PHP manual for full details
    0
  • Webnook
    One more query regarding Contact form : When I receive the contact form inquiries on my mail id, It shows as removed and I can't directly reply to the sender. See the attached screenshot. Can anyone help me out through which I can avoid the above situation and get the sender email id in place of removed so that I can directly reply. ** I had changed $mailheader = "From: $name \r\n"; to "From: $email \r\n"; but then I can't receive inquiry from yahoo users. :(
    0
  • Webnook
    [QUOTE="Add the fifth parameter to your mail() line something like[php]mail($to, $subject, $formcontent, $mailheader, "-f you@yourdomain.com") or die("Error!");[/php] or you could try [php]mail($to, $subject, $formcontent, $mailheader, "-f" .$email) or die("Error!");[/php] I think you will get the best results by using a -f parameter that matches the same domain on the server that is executing the mail() function.
    But I am not able to receive inquiries from mobile, i
    0
  • cPanelMichael
    Hello, Generally, you're going to want to use SMTP authentication instead of the PHP mail function to avoid the problems you have reported. Note you will likely receive more user-feedback on how to create or modify the PHP coding on a website such as StackOverflow. Thank you.
    0

Please sign in to leave a comment.