n92
n92

Reputation: 7602

How to create the contact of the sender automatically when the mail is received using Google Apps Script

I have signed up with Google Apps, I am using a third party SMTP Server to send the emails from the web app, Emails are reaching inbox for all the email clients (yahoo, gmail, hotmail...)

But Emails sent to my domain (mydomain.com) are reaching SPAM, This is happening only for my domain Which is google apps account domain. The solution to the problem is the sender must be in the contacts of the receiver. So its a overhead involved in adding the sender in the contacts before receiving the mail. This is not automated.

NOTE: Mails sent from <[email protected]> to <[email protected]> are reaching SPAM. It means, Its happening only when the sender and receiver belongs to same domain.

ASSUMPTION: ALL the emails will be sent from mydomain.com .

So, I want to write a script using google apps script So that when a mail arrives from mydomain.com (having FROM address belongs to mydomain.com), The script must execute and add the senders emails address in the contacts. So it will avoid the spam rate.

I am very new to google apps script, Please help me doing this, Or if any better solution is there please feel free to post.

Upvotes: 1

Views: 853

Answers (2)

Weehooey
Weehooey

Reputation: 1008

Vinay,

It sounds like you may have an incorrectly configured SPF record. Please see this article:

https://support.google.com/a/bin/answer.py?hl=en&answer=33786&topic=2759192&ctx=topic

Email that has a mydomain.com sender address, needs to come from a mail server listed in your SPF record or risk being sent to spam.

Upvotes: 1

JSDBroughton
JSDBroughton

Reputation: 4034

By chance, has Contact Sharing been enabled for your apps domain? I'm just offering this as an hunch that might help rather than a specific solution to your problem.

If this doesn't help, its a straightforward but non-trivial problem to add all your domain accounts to each others contacts list (and keeping it synced over time), but you'll be leaning heavily on a version of the Contacts API rather than plain Apps Script because the Contacts service only operates on the contacts of the user executing your script.

Upvotes: 0

Related Questions