About two years ago, I created a Node.js application that would send emails periodically through Gmail's Less Secure Apps option. This worked quite well, but they recently got rid of it. I have G-Suite email addresses under my domain that I would like to send emails from, but the new Gmail API takes quite a bit of effort to set up and maintain. Is there a way that I can use Node.js to send emails from those addresses, but in a simpler way? Could I possibly use another SMTP server, like Yahoo or iCloud, with Nodemailer?
if you want to continue as you are just create an apps password.
otherwise you can configure a service account and set up domain wide deligation through your workspace domain account.
The service account will be able to send email on behalf of a user on your domain without any authorization needed. This is probably the most robust solution
Related
I set up an Azure SendGrid resource in my company's Azure subscription, got my API key and wrote a C# script to send emails. It works, but the emails go to spam with an SCL=6. I expect this is because I am doing no domain authentication. (Please bear with me as I try to describe my situation, I'm still learning a lot about all this). I am sending the emails through my work/enterprise email account (XYZ#company.com) and they are going to other enterprise accounts on the same domain (company.com). My company is a large tech company with a very well known domain. I am just a user on the enterprise network as a normal vendor/employee, with this setup I don't know how I would touch DNS/SPF/DKIM options, which from what I've been reading are the main first steps to authenticate myself as the sender.
I guess my main question is: Can SendGrid be a possible solution to what I am trying to do? I want to send ~250 emails programatically, each from a template so I can substitute in recipient name and specific info, and I can do all that through C#. But is there a way I can authenticate myself so my emails do not go to spam? If not, are there alternative solutions? I'm just trying to avoid having to manually send ~250 customized template emails through Outlook.
Let me know if I need to provide more info, all answers are appreciated! Thank you!
I know there's an API for a Gmail plugin in your browser. Is there one for the server? For example, if I want to write an anti-virus app that reads emails coming in to an account on the server, then let's them continue or quarantines them - all before the user ever sees them?
Obviously it would have to be authorized for the users it did this for.
EDIT: As of 26/06/2014, this answer has become incorrect, as Google just released a dedicated API to GMail. See the link in this post for reference.
Original answer below this line :
From a technological perspective, it's a mail server just like any other.
Thus, your choice should fall on a mail protocol. It's also already answered in the question you linked: https://stackoverflow.com/a/2820280/1680196
Your app would open an IMAP connection to your mail server of choice (in this case gmail), scan for incoming mail, read the content and trigger a delete / move to trash if necessary.
Personally, I wouldn't trust any app like this running outside my own mailserver / mail client, since this use case requires full read and write access to a users mails.
There might be some API for Google Apps for Domains mail accounts, but I doubt this goes beyond the RSS mail notifications.
Edit: Official Google api documentation also refers to IMAP for accessing user inboxes. Link to IMAP OAuth overview. With application specific passwords users could enable your app to access their account without exposing their actual credentials, but beyond that I fear you are out of luck.
There is an HTTP REST API now!
http://developers.google.com/gmail/api/
(And has been for years if you were willing to use IMAP. :-D)
I want to use node-mailer module to send emails to registering users on app for verification and other purposes also. I am not sure which transport mechanism to use so that emails I send are not a spam and also get delivered.
I also want to use the same domain to receive emails regarding support and bugs(i.e lets say on email on support#example.com). I am planning to set-up google apps account for this. Basically I will set-up the google apps account with me being an user and having an alias support#example.com. So can I also set-up an alias with say admin#example.com and send the emails using nodemailer from my app using this email address? But obviously I don't want to store my email id and password for google apps in the code for security reasons. So how Should I do it?
Other option is to Amazon SES, I believe its a good service and would be very useful. But can I use the same domain name for serving email from AMAZON SES and google apps also being able to host my app? So how to send emails from AMAZON SES by authenticating SPF and DKIM so that these emails reach the inbox of the user.
Saransh,
You absolutely can use the same domain and email address with both Google Apps and AmazonSES without any issues. When it comes to receiving emails, all messages have to be directed to a single server (your MX records). But sending email is very different in that you can send email from many different sources without any issues.
To ensure your messages don't go to the SPAM folder just be sure to properly authenticate all your messages with SPF and DKIM. I'm not sure how this works with AmazonSES, but it was really easy with the provider that I chose for my email http://socketlabs.com
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 <xyz#mydomain.com> to <abc#mydomain.com> 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.
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.
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.
I have a requirement where I have to count all sent email by users belonging to a domain that they manage with google. All email is of course managed with gmail.
Although this task initialy seemed trivial, there doesn't seem to be a way to do this directly, meaning through some API call.
Any ideas?
Thanks
Stelios
As far as I know the Gmail API doesn't offer access to the total of send items.
Tthe g4j project (written in Java) reverse engineered Gmail's protocol in order to access an account using HTTP calls. However, the solution is fragile since it could be easily broken whenever Gmail decides to change its HTTP protocol.
Screenshot of a Java application build on top of g4j:
It's not easy but there is a way to access a gmail account.