I would suggest to use the server’s built-in email service, as its much more reliable than the SMTP connects that has to open the numerious requests through the sockets.
These are they key points you should nkow, to get your emails sending:
- Make sure the sender field is under your domain. This policy has been enforced on 99% of the servers, to prevent spam, or in other words so that people cannot send a face email from someone’s else name. You use your actual email such or “support at yourdomain dot …” or use robots/ no-reply address.
- Make sure you send the right headers. Some of the servers will not send email if they don’t support your header, or if you have a syntax mistake. To find out what headers you should use, try to research about the header for the mail() function online. If after experimenting with different headers you still have no luck, contact your webhosting support – and they will be most likely willing to help you.
What I did to make my contact form work is, I replaced the wp_mail() with a simple mail() function (in my themes/alltuts/contact.php)
as follows:
mail(‘support@my_site.whatever’, $subject, $body, $headers)
(Use the email address where you want to recieve it.)
These are the headers I defined just before sending:
$headers = ‘MIME-Version: 1.0’ . “\r\n”;
$headers .= ‘Content-type: text/html; charset=UTF-8’ . “\r\n”;
$headers .= ‘From: Your_Title: my_site.whatever : Automated Message <robot@my_site.whatever>’ . “\r\n”;
$headers .= ‘Reply-To: ‘.get_bloginfo(‘name’).’ <‘.$email.’>’ . “\r\n”; //These are sender’s email and name.
Then the email of the sender I appended to the body of the email, something like that:
$body = “Name: $name
Email: $email
Message: $message”;
Hope that helps, cheers ??
PS: Also note, on some server you won’t be able to send an email to your self. So if you send to yourself to ‘support’, use the ‘robot’ or ‘no reply’ as the sender.