Custom Email Marketing from Django on Slicehost Server - django

I have a Slicehost slice running django through nginx and apache. This is for a project in which email marketing is a key component. We will need to be able to send up to 10,000 emails in a day from this Django app. We need to recieve email as well, however, that can simply be a forwarder.
What would be your recommended solution? would you setup a postfix mail server on the slice or try to use some 3rd party mail service with an API like MailChimp or constant contact?

Sending thousands of emails from your own machine in a reliable way is very hard.
I would recommend you to use SendGrid. You can use them as a smtp server, so there's no need to code against APIs. They can also receive email and POST the data to a URL on your server.

Related

Problem with sending email in django using SMTP with new google rules

I am using smtp to send emails in django app but for some reasons it stops working and i found this on the google page.
I do not want to use SendGrid or others.because in my app i send more than 1000000 emails per semester and it was working well before this new condition.
How can i solve this problem ? Thanks.
Try to create an application token in the Google account you use to send the emails with and use it instead of your usual email password.
Have a look at this link: Authorizing Your App with Gmail

How can I allow users to send emails through my django app but coming from their own gmail account?

I have a django app where users can send emails through the app to contacts that they upload themselves. I use Sendgrid to send the email and the recipient receives an email from a "white-label" address like hello#mydomain.com
Now, I would like to implement a system where I can allow users to send emails through our app but that those emails are sent by their own email address. To make it simple, let's just consider "Gmail" and if a user want they can "login with their gmail account" on my app and then send emails from my app that are sent from their account... I know that Gmail has an API and I wonder if I can leverage it to do what I need.
You can definitely send emails using Gmail API methods but keep in mind the below stated in their official documentation:
Note: The Gmail API shouldn't be used to replace IMAP for developing a
full-fledged email client. Instead, see IMAP, POP, and SMTP.
As they recommend, you could integrate IMAP/SMTP features in your application so users can authenticate/provide access to their accounts and achieve your goal of having emails sent from their accounts.

How to configure Django such that emails are sent by both smtp, and to a log file?

I'm frequently plagued by the complaints that email from a django application running on its own Ubuntu LTS 16.04 server, is not being received. Typically these are the password change request emails, so they're part of the standard Django Auth module as I understand it.
Django's sendtestemail appears to work reliably, and many of the expected emails are actually sent and received (from what we can discern). The smtp setup is such that EMAIL_HOST is set to an smtp server on the same network that supports anonymous message relay (from servers on the same network only), and the EMAIL_BACKEND is the typical django.core.mail.backends.smtp.EmailBackend. Using the console backend for testing shows that emails are triggered as we would expect on these various events.
So, what I want to be able to do, is to have both email sent out via the smtp relay as expected, but also be added to a log file, and for this to happen for all emails generated by all the email events in the Django app.
Is this possible using django configuration?
If not, can you recommend a method by which I can both send and log the emails?
Bonus query - can the solution allows me to resend an email using the original content?

"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.

Custom mass mailing with SendGrid

I have requirement to send customised(per user) newsletter to thousands of users.
I created a django app which generates custom newsletter content based on user preference.
I am using SendGrid, and planning to add celery to send newsletter one by one.
Sendgrid docs says:
Customers should utilize SMTPAPI if this is an option. As with SMTP, 100 messages can be sent with each connection, but there can be 1000 recipients for each message.
Is there anything like --- SengGrid collecting all the emails I throw at them, make SMTP connection and send to user.
Otherwise, as every newsletter is unique based on receiver, I will have to make single SMTP connection for each email, which I think won't work in case of thousands of emails.
Or is there any other options?
I would just set yourself up to use their REST API. I have used that to send thousands of emails per day. http://sendgrid.com/docs/API_Reference/Web_API/mail.html
If you are worried about performance then make it into a job with Django Celery