Saturday, June 29, 2019

Re: Sending Email from form

You're welcome Emmanuel.

Fyi, I think using one email as the 'from' address and sending the user-provided one in the email body may be easier, as mail sent from different addresses yet from the same mail server IP address may be flagged as spam (Barracuda Networks is an example of such an enforcer).

My solution was as follows:

- Declare a Django Form that accepts the email address. Call the field whatever you like, e.g. 'email_address'
- In your view, if request.method == 'POST':
-    if form.is_valid():
-        email_address = form.cleaned_data['email_address']
- Build a message and include the email in its text
- Call send_mail(...) and use an email address you provided (as the 'from' address)


Kind regards,
Lloyd


Sent with Shift

On Sat, Jun 29, 2019 at 6:25 AM Emmanuel klutse <nuelklus@gmail.com> wrote:
Thank you Dube!!! Will check it out and update shortly. 

Sent from my iPhone

On 29 Jun 2019, at 2:27 AM, Sithembewena L. Dube <zebra05@gmail.com> wrote:

I just finished a project where I did the same thing you require.

I used the Mailgun API.

The relevant documentation can be found here:
https://documentation.mailgun.com/en/latest/user_manual.html#sending-via-api

Kind regards,
Lloyd


Sent with Shift

On Fri, Jun 28, 2019 at 8:22 PM Emmanuel klutse <nuelklus@gmail.com> wrote:
Hello Team. 
I'm new to programming and I've been studying Django for 6 months now. I just started my first project and i need help with handling sending emails from a user form.
I am using send_mail function to allow anyone who wants to contact me through my contact page. Its is working fine but I need a way for Django to allow me get an email from my application using the email address provided by the user in fill the form instead of the one I provided in settings.py.
Please help…. I have been on this for the past one week. 

I'm also available to assisting anyone who needs someone with my level on a project for free. 

Thank you
Emmanuel klutse
+233202729851

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/60A5D9BF-5096-4824-90D2-7149E1ACC82E%40gmail.com.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAH-SnCDv4dz8%2BFyr3%2By-0GUxX41Nbnv%2BjsXrgnquOGVHp83vpw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/693AE2FF-CD94-416C-8527-7497F0C7A853%40gmail.com.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAH-SnCAQnTp20Koy8z2XkN11OdUHTLMx50nr%3DpFbimsLRhYWCg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment