I would like to parse inbound emails in a Node.js app hosted on Digital Ocean. I want to create an email address for my app's domain that can post to a webhook. How do I create an email address like name#example.com (or name#subdomain.example.com)? I am trying to avoid creating one through a third party because I just need to quickly parse the incoming content, and don't need all the functionality of regular email.
For parsing, I am using Mailin.io, and following Mailin's documentation I have changed my Domain records on Digital Ocean as follows:
MX 10 subdomain.example.com
A subdomain [ip address of my droplet]
I have the webhook set up at http://www.example.com/webhook, and if I post using curl, I get the expected response, but I can't figure out how to post to the webhook via email.
Am I going about this the right way?
Related
I've setup two mail servers
1. Gmail sever for handling certain email of my domain.com
2. A custom sendgrid inbound parse that also accepts certain email for my domain.com
Now I've two MX records on DNS setting for both mail servers. but I see only one is working . That one works which priority is only 1. Even I tried setting both priority to 1 only one works.
How can I make it working send on both.
Or can i create some custom service that forwards mail to mail server depending on from_email address ?
Mail will always be sent to just 1 mailserver, which is chosen by the priorities of your MX records.
To be able to use 2 mailservers for 1 domain you can have a look at Split-Domain Routing (SDR)
Easiest way to handle this to have your gmail on your primary domain.com and sendgrid on your subdomain something like notification.domain.com so that you can send and receive emails using sendgrid (xxx#notification.domain.com) and using gmail (xxx#domain.com). You can have MX records of Gmail corresponding to host domain.com and CNAME records for sendgrid corresponding to the host notification.domain.com.
I am using the SendGrid for receiving the emails from my domain (example.com). I have configured all the steps from the mentioned link Sendgrid Inbound Parse Webhook.
I have added all the name records(MX records and CNAMES) in the GoDaddy DNS records against my domain.
The issue is when I send an email to hello#example.com. When an email is sent to this email-id there is no mail delivery failure report. There is no any statistics for the SendGird console about the webhook got triggered.
I am not able to figure out what went wrong in this process. As emails in the sendgrid webhook are not received.
I think they are lost in between.
I found the documentation to be insufficient in this area. You need to send to the subdomain, listed in your MX record, which redirects mail to sendgrid.
For example, if you add a MX record for email.example.com, you need to send the email to user#email.example.com.
One of the best ways to test if a 3rd party Web API post is being triggered or not is by using a tool that receives posts and provides visibility to the data sent along with the post (e.g. Headers, parameters, and the related data in json, text, etc).
One of the tools that I have used to test if a post is being triggered or not is offered by: https://requestbin.fullcontact.com/. Take these steps to set-up your testing environment:
(note: I am not associated with the requestbin.fullcontact.com resource - I am just an enthusiastic fan of this very useful service).
Go to requestbin and "Create a RequestBin". This will create your own unique requestbin URL. (e.g. https://requestbin.fullcontact.com/xxxxx)
Copy this URL, and paste it into your SendGrid Inbound Parse "Destination URL".
Keep your testing environment simple initially by NOT checking the "Additional Options" (Check incoming emails for spam & Post the raw...).
Be sure you do not enter a 'Subdomain' in the SendGrid Inbound Parse "Receiving Domain" unless you are expecting users to use the subdomain as part of your email address.
Re: #3, same applies to your DNS at GoDaddy. Your email should also not reflect a 'subdomain' as part of your MX record (e.g. you should not use mail.example.com).
Click "Add".
Now, send an email to your domain (e.g. info#example.com).
Check your requestbin to see if a post was made by using your unique requestbin URL, appended with "?inspect" (e.g. https://requestbin.fullcontact.com/xxxxx?inspect).
Result: You should see post information when viewing your 'inspect' URL.
Using this first step of a diagnostic process to test your usage of SendGrid's Inbound Parse should help expose potential problems in your configuration (e.g. DNS set up would be the next area to look at if no post data is being received in the requestbin inspect URL). Good luck.
I have created a simple ASP.NET Web API app that receives parsed emails from SendGrid. Works well on my machine using a secure tunnel with ngrok. The parsed content of emails is posted to the locally hosted app.
However, when I deploy this app to Azure it does not work. I tried to use both HTTP and HTTPS for the callback URL in SendGrid, but emails are not processed. In the Activity page in SendGrid there is no entry for a Parsed email. And I get back a delivery failure email, for the email that should have been handled by SendGrid.
The response was: 550 no mailbox by that name is currently available
I know the app is reachable because I can do successful HTTP requests to other resources, from the browser or other tools.
Is there something that I might have missed? Some additional configuration, either for the app or in SendGrid?
The short answer is this:
If you use CloudFlare for your DNS, it is highly likely that CloudFlare is stopping the inbound parse posts from SendGrid.
Review your Firewall Event Log in CloudFlare (under the Firewall Tab) and see if your Web API "Host" is appearing there.
If so, what you'll need to do is whitelist the IP Address range that SendGrid uses to send posts for the inbound parse.
Their current IP range for the inbound parse as of today is 167.89.117.0/24 (basically of the IP address from 167.89.117.0 to 167.89.117.255).
Hope this helps you or someone else with this same issue/root cause.
Given an email address, like "user#example.com", I'm trying to ascertain information about the email server they use, information like:
Domain
Port
Uses TLS
Currently, I can split the email address into two parts (for instance user and example.com), then do a MX lookup on the domain in order to attempt to ascertain the mail domain used:
dns.resolveMx(hostname, callback)
However, several hosts seem to use other servers than those (for instance, JustHost encourages all their domains from example.com to justXX.justhost.com in order to provide them with TLS) and attaining those is proving to be tricky.
The port is okay, as long as they use a default port, else as far as I can see it's impossible and TLS is easy to work out as long as I have both the domain and the port in order to contact the server.
Since all these methods seem unreliable at the best of times, are there better methods of ascertaining this information? This is in relation to making a mail client, which attempts to logon to the mail server to retrieve emails, and using the SMTP protocol in order to send emails from that server.
The only information that you can rely on is what is available in DNS. This is all of the info that is needed to send mail for a given address.
If you want to receive emails then it's an entirely different story. You didn't mention which mail server you need. The server that gets the incoming email? The server that lets user send email? The server that lets users download their emails? I'm assuming that you want the server that you can send email for that domain to - what is available as MX in DNS.
You didn't mention why you need that info but if you want it so you could send emails for those domains then you can sonsider using a transactional email service like or Mailgun, Mandrill or Amazon SES because it will handle all of those details for you. But you didn't say what is the purpose of getting that info so I don't know if that will help you, I'm adding it just in case.
I installed on a Google Compute Engine postfix as a MTA.
The Mails are sent via sendgrid.
Now any Mails (tests, errorlogs, cron...) to GMail are marked as Spam.
Sending the same mails from an normal server without sendgrid is no problem.
(I have many root-server and are just trying sendgrid)
Why does google think that every mail from sendgrid is spam?
try with this:
https://serverfault.com/questions/115161/fixing-my-mtas-poor-reputation
and Maybe your IP its reported in blacklist.
Try using other reserverved ip address in your instance.
https://developers.google.com/compute/docs/instances-and-network
For maximum deliverability, SPF and DKIM records need to be setup and properly configured in the DNS records for the domain you want to send mail from. Assuming you signed up for the [free tier of SendGrid][1], available to Google Compute Engine customers:
SPF: make sure the string include:sendgrid.net is present. The most basic setup would then be v=spf1 a mx include:sendgrid.net ~all, if all email for the domain is sent via Sendgrid this is enough. If you have more complex needs, use an SPF builder, such as Microsoft's.
DKIM: get it from the Google Apps account manager, under 'Settings for Gmail>Settings for Gmail'
After those two are in the DNS records for the domain in question, use the Port25 verifier to ensure all settings are correct. Of course, if you want to test whether mail from the server is properly setup for deliverability, send them email form the server. Same for email from Outlook, etc.
PS1: These instructions vary slightly if you are using a paid version of Sendgrid
PS2: All Google Compute Engine IPs are listed in Spamhaus PBL. Email should not come from these IPs directly (but if you have a specific reason to do so you can contact GCE Support - which is not free - and request that they add a reverse DNS record for you so you can start sending mail from this address directly).