Support » Localhost Installs » wp mail and smtp

  • Hi, and hope this is in the correct forum.

    Recently moved a domain which has it’s on mail server. I’ve re-routed the mail, it’s working fine. Problem is they can’t get an emails from the site’s forms.
    SMTP plugins which i’ve tried either don’t deliver the mail or the email appears in html code and not readable.
    It’s been frustrating because I have to constantly watch my email and forward it to them. Does anyone know a fix in WP scripts?


Viewing 10 replies - 1 through 10 (of 10 total)
  • believe me its not broken…. well probably…
    local webservers seldom has a working mail server so most of the time wpmail or phpmail wont work.. but its all ok until you transfer it to a new server with a working mail module.

    thanks for your reply, you seem to know this better.
    Is it correct that they have to provide me with SMTP details or is that something i need to create in cPanel.
    I’ve been trying the plugins using gmail

    nope… by default wpmail should work fine but there are other plugins out there that you can use if you want to use your gmail to do the mailing… or other email servers

    Hi jcwebhole,
    hhmmm still don’t get it. The forms (formidable in this case) is using wp mailing and their server throws the emails out. They don’t even reach them. I’ve asked them to take their filters down if there are any.
    they’ve only provided me their IP and the server address and that’s not sufficient for SMTP plugins. hence i used google.
    Will the smtp details be the same as the one under cPanel (where the domain is hosted) or different since they have their own mail server?

    itll be the same most of the time… just make sure you have setup the correct mail account in your cpanel

    but that’s exactly the problem. The emails are not created on cpanel, i only configured the mail server IP address. All emails are delivered to their server and not stored in the main host.

    so you should create the email user first.. then it might do the trick

    Thanks for your help, will try that.

    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.

    Hi Spirulina, apprecieate the details, looking into it.
    However, I’m using a forms plugin and my theme doesn’t come with a contact.php form. It all seems to be a bit out of my scope and it’s been a month already. After some reading about headers, seems to me the only change the appearance and it’s suggested to make the changes in functions.php
    I’m so puzzled but now I’ve sent my host with the error log from the plugin. Digging into code as novice is scary.
    Will keep you posted

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘wp mail and smtp’ is closed to new replies.