Creating a 'View in Browser' link in Mailgun - mailgun

I've managed to create an email template and sending out email via the Mailgun API along with using the standard variables like the recipient details and the unsubscribe links.
But one thing we would like to offer to the user is the ability to view the email in their browser instead of in the email client. Does anyone know if this is possible out of the box? I've checked all the documentation and I cant see any way of achieving this.
Thanks in advance.

Related

Django email contact me form

So I'm working on this django web app and I want to create a contact me form for my client. My client wants the users of his website to be able to send him emails directly from the form available on the platform. But my client uses a free yahoo email address.
I'm kind of confused of where to begin. But here is my suggested approach see if you can give me an advice:
1- create a form in the forms.py with the different fields of the form.
2 - link the form to the template.
3- create the view for the contact form.
4- add the path in the url pattern.
I read an article that says I need to go through an email service like SendGrid to actually send an email. But it said that I need a professional account to be able to do it.
I really appreciate your attention.
Your way to go looks good.
You do not need any sending service, as long as you have a proper SMTP account to use for sending.
Just add the SMTP credentials to your settings.py and you can use the django core functions to send email messages.
https://docs.djangoproject.com/en/4.0/topics/email/#send-mail
https://docs.djangoproject.com/en/4.0/topics/email/#smtp-backend

How to create an unsubscribe feature in Django?

I am working on a django project, and I'm needing to add an unsubscribe feature to my emails that the server will be sending out. The way that I am managing the mailing list is through a .csv file, which when someone signs up for a service of our's, they get added to the mailing list. In the emails, I want to add an easy unsubscribe feature which would only require the user to click the link in the email, which would lead them to a page that will have a button for the user to unsubscribe from the service, which would be accomplished by removing their name from the mailing list .csv file. My question is, how do I set it up where, when the link is clicked in the email, the website will already know which user is attempting to unsubscribe?
I was attempting to follow a tutorial here Tutorial but I do not have a "user profiles" set up, as it mentions. What other ways might this be accomplished? Is there a way to send the email's username to the website when the page is visited in order for me to make the unsubscription process easier?
Thank you in advance!

Django Unit Testing That Needs OAuth Authentication

I have a Django project that uses Gmail API to send bulk emails. Users can create campaign emails and send them to multiple contacts. If a contact answer to any of the emails in a campaign then that contact should no longer receive emails from that campaign email.
I want to add unit tests for this feature and I don't know what approach to use because I need to authorize one Gmail account first and only after that use that account to send the campaign email. Also I would like to test the replies of that campaign, which means that I need to authorize a new Gmail account that will be used to send the reply.
So this is what I plan to do:
1. Authorize two Gmail accounts manually.
2. Inside the tests I will search for the first two Gmail accounts from the database and use one of them to send the campaign email and another one to reply to an email.
The only problem is that I am not sure that this approach is the best, this is why I am asking here, maybe someone has a better idea.
Thank you!
You also can write accounts authorization code in unittest.TestCase.setUp(self) method. It will be called right before each of your test methods. Considering OAuth usage, I strongly recommend to you to use Requests package. It's quite handy in any API testing and stuff.

Calling Zapier trigger from Django Code

Is there any way I can call the "Zapier trigger" from my Django Code,
Basically, I am having a Django form where the user will enter several email-id and when the user clicks on send button then I want to send this form data to Zapier in order to do the next action like writing in google spreadsheet or sending email to everyone.
David here, from the Zapier Platform team. The easiest way to do this is to have the form submit against your server and use a library like requests to POST to Zapier. This way, you don't have to worry about CORS or revealing the hook url to your users.
Hope that makes sense. ​Let me know if you've got any other questions!
I am not sure from your question if this is related to how to make the call from Python (which #xavdid answered) or how to trigger a zap. If this is about triggering a Zap, here's the answer.
Setup a Zap by choosing the Webhooks by Zapier app as the trigger. Choose catch a raw hook, if you need more control. In the next step, you will receive a URL where you can POST your form-data.
Everytime you POST data the Zap will be triggered. You can use the data available from your request in the action step for Google Sheets or Emails.
Here are a few Zap Templates that you could start from.
Add info to Google Sheets from a Webhook POST
Send emails from a Webhook POST (Using Zapier's email app)
Send emails from a Webhook POST (using Gmail)

HTML rich email invitation with RSVP button to database?

What I am trying to do is this:
Send an invitation for an event via HTML eblast. I would like the users to be able to RSVP straight from the email (click Yes, No, Maybe) and by doing so, will send that info into a database for my client to view the responses.
They specifically do not want responses coming in as emails, they want to view it as a list, and does not want to use something like evite. I've looked everywhere but don't see how to do this. Any thoughts? Thanks in advance!
I believe you would need to dynamically generate an email message for each recipient.
You would alter the Yes/No/Maybe URLs for each recipient so it sends their information to a web page (php/aspx/whatever) that then adds their selection to your database.
So you would loop through your list of recipients, generate the email with a variable altering the url of your Yes/No/Maybe links to something like http://yoursite.com/rsvp.php?user=<TheUsersName>&selection=<YesNoOrMaybe>.
Then just have that rsvp.php page set up to pull the GET variables you passed with the link and add them to your database.