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.
Related
My main goal is to setup an email address for my server to use for sending emails only.
I did some research, and it looked like Amazon Simple Email Server and/or Amazon Workmail could provide me with what I needed. I've gotten as far as setting up SES and Workmail so that I can set my server to be able to send emails. However, I saw that once the Workmail inbox is full (50GB), the account would be unable to send emails. Given that this is going to be used by the server and not a human, I didn't want the inbox to get filled with auto replies, spam, or failed to send messages, and then be unable to send emails. So, I went looking for a way to either:
A) prevent emails from being received and stored in the inbox
B) a rule I could setup to delete anything that didn't match the company domain
C) be able to read the inbox and delete email messages using the AWS CLI, and I'd setup my own script to manage how and what was deleted when
So far I haven't had any luck.
Again, I'm not particular how I achieve the goal, but I do preferably need to find a way to have an email address for a server to use exclusively for sending messages. I worry that if I leave it to employees to remember to login and clear the inbox, someone will forget, and then the server will stop sending emails.
Any direction or advice would be greatly appreciated.
I'm not well versed in email protocols; could I setup the address to return a bounce back always, and that would prevent it from receiving emails into it's inbox?
How are you generating these emails? If you are generating them programmatically (via an app/script), you may not need to set up a server. If you just route the outgoing mail through your app to SNS, the emails will be valid, however, there will be no "inbox" for incoming mail and they will just be dumped. This way you don't have to actually worry about an inbox getting full as it will just drop anything coming in.
https://docs.aws.amazon.com/ses/latest/DeveloperGuide/receiving-email.html
In order to receive emails though SNS, you have to go through the setup linked above, but if you do not set this up, then emails will just bounce. At least, that is how I have been doing it.
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
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.
I hope someone will be able to help me with this since I am new with AWS stuff.
I have a Web App using .NET MVC which will be deployed/hosted in AWS. This is the description of what I would like to achieve:
1- Let's say that the Web App will insert products in a Products Table on SQL Server.
2- When this product is inserted, the system (AWS) will send an email to a Client from a Clients Table on SQL Server.
Is that possible with AWS?
Could I set a trigger in SQL Server and send an email by SES?
Is it better to use SQS?. So the Web App will publish messages in SQS, and then having another app listening and sending those emails, for instance a console app.
I will appreciate any direction or useful link.
Thanks all of you in advance.
The answer to your first question is 'yes'. Yes SQL server can use SES to send emails. Because SQL server can send emails, all you need to do is set it up to use the correct SMTP settings from SES once your account is verified and working with SES.
That said, I would never have my db server send emails, just doesn't seem like the right place to do it; even though you can.
I have developed and support several systems like this, and the usual pattern I use is to have the web application insert a message in an SQS queue that will be used as input to another process to send the email out. When possible I like to include all the details about the email into the SQS message, i.e. from, to, subject and the body - everything the downstream process will need to know to send them out.
In my case I use a windows service running on several EC2 instances in an autoscale group to poll the queue and send the emails out. In most cases, where I was able to store all the emails in the SQS body, the windows service is completely general purpose - it reads an SQS message, composes the email and sends it out. Because all of the details of the email are within the SQS message body, this single SQS queue and the windows service that is processing it, can process emails from a variety of applications because the service doesn't need to contain any business logic specific to the application and has no external dependencies.
As you talk about separation of responsibilities, I can't see anything less indicated to send email than a db server (even if it can do it).Sending emails is a task for your business layer, surely not for the data layer.
Use the web app to trigger the process of sending the emails, than implement it directly into the web app, or separate it with a messaging system (like SNS), with a queue system (like SQS) or whatever else.
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