Email always goes to spam folder

Viewed 289

I am trying to send a google login link in email body, but it always marks as spam.

The reason which i've found only is accounts.google.com, even though the 'google.com' also not. When i put account. in start of this; it goes to spam otherwise everything works perfect.

See the link and email body below.

$google_link='accounts.google.com/o/oauth2/auth?response_type=code&redirect_uri='.$site_url.'&client_id='.$client_id.'&scope=email+profile&access_type=online&approval_prompt=auto'; 

 $html.='<div>

         <a href="'.$google_link.'">Click here</a>

    </div>  
            ';

wp_mail( $email_address,subject, $html, $headers);

Question: Is there any way to encrypt this URL in email body to send and it works proper in email/gmail inbox?

Is there any other way to avoid the email going to spam like marking specific email by it's subject using any third party mail sending tool?

1 Answers

You can use the third party service SendGrid by registering and installing their WordPress plugin. SendGrid process your email text and replace links with links to SendGrid such that the accounts.google.com will not appear in the email. Upon a user clicking the link, SendGrid will record the click and redirect to your original URL.

Alternatively you could create your own redirect URL. The most secure method would be to have a table to store the URLs and generate a unique token such that you could put your own link in the emails along with the token. When your script is hit, pull the target URL from the table that matches the token and redirect to it.

Related