Send email with custom from with amazon ses for several domains - amazon-web-services

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

Related

How can I use a single gmail address in a MTA (Mail Transfer Application)?

I would like to allow users to send automated emails from a dedicated email address (automated_alerts#my-domain.com).
However, in the scripts, I don't want to give users access to the credentials.json so that they can modify the scope. I don't want to use a service that I need to pay for such as Amazon SES.
I have looked into resources at the following links below, but I want users to simply specify an html body, any attachments, and the recipients and then forward this on to the MTA. If a user leaves the company, the automated emails should not fail when the user's email gets closed out. The script would just need to get moved to a different server's cron or whatever.
Is there an easy way to do this? I am happy to use Django also, but would prefer to avoid using SES and having to pay to send internal company emails:
https://docs.djangoproject.com/en/2.0/topics/email/
https://github.com/django-ses/django-ses
https://developers.google.com/gmail/api/auth/scopes

How to send email on users behalf using AWS SES?

I can see that from SendGrid I can send email, where the from field will show any email which the end user will put. With AWS SES how can I achieve this?
As I see in the docs it needs to verify the email/domain before doing this. Is there a way to do this?
In SES you can only send emails from verified domains or verified emails. And in either cases you would need to own them otherwise you cannot verify them and subsequently you cannot use those.
Once you verify a domain it is more liberal in the sense that now you can use any arbitrary id at that domain
So e.g. if you verify xyz.com domain then you can use any id #xyz.com
E.g. myid1#xyz.com or jghdgd#xyz.com
That might be about policy
Not very familiar with send grid.
We use sparkpost as another ESP and there as well you can only use only authenticated domains. And that makes sense as well because otherwise people can just adopt any arbitrary identity for spamming

"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 would I know that email has been sent or not via SendGrid in Django

I am working on django and sending emails to multiple users at once. in the given scenario it only tells me that if it has sent or not.
I want to display the report of same page that how many emails has sent to user successfully and how many not. more if i want to get details why email has failed to sent.
How would i do such things via SENDGRID APIs.
There are two options that I know of:
Connect to SendGrid Event Webhooks and start parsing events for every email to flag ones that were not sent. I believe you can configure SendGrid to only send certain events, so if you're interested in bounces you don't need to worry about handling all events.
The second option is to use a service like sendwithus which will connect to your SendGrid account on your behalf and track all bounces/opens/clicks for you and provide a simpler API/UI to view the data. I believe they do this via SendGrid's webhooks, so it's effectively the same solution but written for you.
Happy to elaborate on either, I've used both before.

Get and Send messages through amazon api

My company is working with the amazon MWS api, and we are receiving a lot of messages from the customers about their orders.
Is there any way to get these messages using the web services and reply to them?
As #joshubrown pointed out correctly, there currently is no API to get customer messages or send replies. You can, however set up a separate mail account for that purpose, which (depending on your own server architecture) gives you a whole set of protocols like POP3, IMAP, SMTP or even MAPI. Regular emails sent to the "scrambled" customer email addresses will be relayed to the consumer and will shown up as replies in your Seller Central.
No, there isn't a public API for that.
How I was planning to do this (in the absence of an API) was to set up the email account (that would receive the emails from customers) such that it pipes the email content into a script. The script would then write the content to the database (or do whatever you want with it).
I'm using qmail for mail, and if you edit the .qmail file within an email account's folder you can set where to pipe the email content eg
| php /pathtoscript/emailHandlingScript.php
Other email systems will have a different syntax for this.
Then in your PHP code (if you're using PHP), you can grab the content from the stdin stream:
$fh = fopen('php://stdin')
I'll probably use PHP's mailparse functions (eg mailparse_msg_parse_file, mailparse_msg_get_part etc) to properly extract the data from the stream.
As #Hazzit points out, when you reply to the anonymised email address (eg qwugwquigduwqgiqwdgiuwqdg#amazon.co.uk), Amazon will pass it on to the customer.
I created users on my account, redirected mails and made a script to read and reply.