How to send email with Amazon SES using a pure HTTP request? - amazon-web-services

I want to send email using the Amazon SES without using aws-sdk. I need to send it using just a pure HTTP request. In other words, how can I send email with Amazon SES using cURL?

SES has email service and it is possible to quite easily check what is being sent with some external tool to sniff the requests that are being sent from your computer. On the other hand, keep in mind that if you want to do it purely using cURL, you have to also handle authentication and signing your requests before, which will create a lot of additional work.
Here you have example request syntax:
https://docs.aws.amazon.com/ses/latest/APIReference-V2/API_SendEmail.html
Link for the signature (I believe that was the things that oyu were looking for) etc:
https://docs.aws.amazon.com/ses/latest/APIReference/CommonParameters.html
Here you have the link for the endpoints:
https://docs.aws.amazon.com/general/latest/gr/ses.html

Related

Sendy External SMTP Bounce Handler

Sendy will not track bounced email address when sending emails via any SMTP server. It only works when if you hook it with AWS SES.
As I'm using SMTP which is hosted on a Linux server along with IMAP, POP3.
I sent thousands of mail using that SMTP and Sendy is not counting Bounced addresses while I checked my mailbox and there was thousands of undelivered mail.
Is there any way to make it count for Sendy SMTP?
I saw this image in Google, Don't know how to make it.
The image you found does not appear to be part of Sendy -- it appears to be from this third party product. It's not entirely clear.
What it seems to do is connect to your mailbox (the one you showed, with the bounces) using the POP3 mail fetching protocol... and read those bounce messages.
The web site seems to imply that this vendor wants access to your server and will install their products for you, which seems like a very dubious practice, so proceed with caution.

How can I debug my SNS subscription?

I have created a basic SNS topic. It's a HTTP (and HTTPS) request a an endpoint on my web server. The web server is not on AWS.
The endpoint the SNS subscription points to sends me an email containing all of the headers of the request. Even if the headers are empty and email will be sent. A request of any kind will result in an email.
The endpoint will process the request regardless of the HTTP verb used (GET, POST, etc).
If I visit the endpoint in my browser, I receive an email. When I try to request a confirmation within the AWS control panel, I get nothing.
I thought this could be down to me using a Let's Encrypt SSL, but I have also tried using a HTTP endpoint, rather than HTTPS, but get the same issue.
How can I debug this? Is there any way of seeing why the request is failing?
When I need to debug http web hooks and such like this, I use this tool:
https://ngrok.com/
to setup a public endpoint that points to my local web server, that I am running in my development environment, so I can see the request come in, and depending on the language (usually .net for me), I can step thru the code as the request is received in my debugger. You'll need to temporarily point your sns topic to this endpoint.
This won't help if you are not getting the request at all, but if there is any question that the request is coming in, but its not being processed correctly, this may help.

Send email with custom from with amazon ses for several domains

How can I accomplish to send email in Amazon SES with a custom email from for several domains.
For example, I have an application that is used by several clients, and we have a module to send emails. When we send an email it goes with the "amazonses.com domain", but what I want to accomplish is a custom from email for each client, each one has a different domain.
The process for doing this is entirely specific to the current SES configuration steps so its better I provide a link thats regularly updated.
http://docs.aws.amazon.com/ses/latest/DeveloperGuide/mail-from-set.html
The short summary is that you can do this by choosing a FROM option for the emails you are sending from.
Programmatically Setting From
The link above points how how to use the API to programmatically change the FROM value. The link below is directly to the API call for setting from but to accomplish it you'd still need to follow the manual tutorial then replace its steps with equivalent API Calls.
http://docs.aws.amazon.com/ses/latest/APIReference/API_SetIdentityMailFromDomain.html

"Read" Emails with Django

Currently sending emails with Django, and was wondering if there was any way to periodically check my inbox with Django (or ideally somehow alert the server upon receipt of a new email), and have Django extract the message and save it in the database.
You could use an email service such as SendMail or Mandrill (latter definitely has free accounts, former may have).
Each of these services provide inbound email support via webhooks. You provide them an endpoint to hit (make sure to use HTTPS) and when they receive an email to an address you have registered they will send the data via HTTP POST to you.
It is then just a simple case of storing this data to the database. There are a number of 3rd party packages that can help you with this:
http://djrill.readthedocs.org/en/v1.4/usage/webhooks/
https://github.com/yunojuno/django-inbound-email
https://github.com/jpadilla/mandrill-inbound-python
https://github.com/michaelhelmick/python-mailsnake
Although it's rather simple to roll your own should need be.

How to strip attachments from inbound mails in Mailgun before POSTing?

Is it possible for Mailgun to POST only the non-attachment part of emails to my API, to prevent big attachments affecting the performance of the app?
Mailgun can host the attachments for you with the inbound functionality.
You can use the Events API command store(notify=”http://myapp/post”) specifying as shown the notify option, which will send a webhook to your application with a URL on message arrival.
One of the headers sent with through webhook will look something like: ["[{\"url\": \"https://api.mailgun.net/v2/domains/YOURDOMAIN/messages/ALARGESTRINGOFCHARACTERS/attachments/0\", \"content-type\": \"META/META\", \"name\": \"MYFILE.EXT\", \"size\": 74622}]"]
Then you can retrieve it and delete the stored message.
Keep in mind that stored messages are kept only for so long so you should process attachments rapidly.
This is one of the options of the routes functionality that Mailgun gives you.
Personally I love it ! Let me know if something is unclear i can dig into more details!
Best,
I am getting mail on the Mailgun which I am routing to my local server and their. I am parsing the JSON but problem is coming in case of attachments. In attachment json, it is showing the path of temporary file on mailgun server. I need to download the attachment and store it on my local machine.
My question is how to retrieve that attachment. Do we have any API for that?
To access the data from the link, you will need to specify credentials as your get parameters. The user is 'api' and the password is your mailgun's private key
Please refer to this answer that I've given here