1

Okay this is strange, I was working with WP_Mail() function, and it's been called successfully from the following statement, and email was delivered correctly.

if ($temp == 'offline-payment') {
    $return = $this->send($this->get_recipient(), $this->get_subject() , $this->get_content(), array(), $this->get_attachments());
        return $return;
    }

However, I tried to add some testing message just after the subject like this:

$this->get_subject().'test'

But the email was marked as spam by Gmail, I've tested it more that one time to be sure.

Why is the email considered as spam, what flags did it raise? More specifically, was it considered as a security flaw?

  • 1
    Send your e-mail from a server that is allowed to send mail for your domain (using SPF) and signs the messages with DKIM. Or if you want something easy, just look at transactional e-mail services like MailChimp, as they provide plugins for various CMSes including Wordpress. – André Borie Dec 23 '16 at 15:51
2

Your mails are probably being marked spam because the SMTP plugin that you're using is almost certainly used by other users, who other Google users mark as spam. Now when your mail is sent from the same IP, it goes straight into the spam folder. To combat this, have your plugin send the mails to your own SMTP server and then mail then from there. That should do the trick.

A plugin that helps with this: http://wordpress.org/extend/plugins/wp-mail-smtp/

  • this is not about sending the mail, it's about the security measure that made Google consider that mail is a spam. I have a working mail functionality. Thanks. – Emadeddin Dec 23 '16 at 15:32
  • @Emadeddin: Edited my post. Please take a look. – thel3l Dec 23 '16 at 15:37

Not the answer you're looking for? Browse other questions tagged or ask your own question.