I am trying to send emails to my clients using django's send_mail function.
I have configured my email host using a gmail account.
This is how I send my email:
send_mail(cv.QT_CONFIRMATION_MAIL_TITLE[lan], cv.QT_CONFIRMATION_MAIL[lan].format(str(uid, encoding="utf-8"), token),
'mygmail#gmail.com', [useremail], fail_silently=False,
html_message=cv.QT_CONFIRMATION_MAIL[lan].format(str(uid, encoding="utf-8"), token))
this html_message has an anchor tag in it which links to the activation link. In gmail clients the link works, but when I try this in yahoo emails the link is empty.
it is shown in html like this:
<a rel="nofollow"> click here </a>
what should I do?
Related
I am trying to implement the following functionality.
The server sends an email to a user who doesn't necessarily have an account in the server.
In the email, the user is asked to rate a certain model (send a request to the server).
Can I make it in such a way that the user can click the button and doesn't get redirected to some other page, but sends the request directly to the server.
<div>
<p> Hi {{ user }}, </p>
This e mail is to kindly ask you to rate {{ job_seeker }}, who previously
worked with you.
Please rate him from 1 to 3 below.
<button onclick="some function that wont work in email">1</button>
<button>2</button>
<button>3</button>
</div>
I am using django.
NO, you cant execute JavaScript in email templates.
Due to serious security issues, most of the email clients block JavaScript from executing. that's why your redirection script doesn't work.
the solution is to use an <a> tag with a URL that specifies the page link instead of <button>.
I'm setting the authentication process in my Django project.
In my password_reset_email.html I have set the following code:
Someone requested a password reset for the account associated with the email {{email}}.
If you haven't changed any passwords, I will ignore this email.
Follow the link in case you proceed:
{{protocol}}://{{domain}}{% url 'password_reset_confirm' uidb64=uid token=token %}
But when I send the e-mail, the hyperlink does not work; there appears only the text of the link.
How could get a working hyperlink?
The relevant docs for you would be PasswordResetView.html_email_template_name:
html_email_template_name: The full name of a template to use for generating a text/html multipart email with the password reset link. By default, HTML email is not sent.
With this, your code could look something like this:
path(
'accounts/password_reset/',
PasswordResetView.as_view(
html_email_template_name='my_email_template.html')),
See this answer of a very similar question.
I've write a functionality about send email process. Here I've set Mail Server details admin setting. And write a below code for sending email. I can successfully send & receive email to my gmail account. But Here I've added some paragraph with anchor tag value that is click me.
<cfoutput>
<cfmail from="test#gmail.com" to="test#gmail.com" username="myemail#gmail.com" password="mypass" port="587" subject="Chaange title" >
<p> I'm from test link click Me 2! </p>
</cfmail>
</cfoutput>
The issue is in my email not received as a click me as a link. Instead it will display entire html about anchor tag. FYR please refer my email content image.
Note : I've already tried with cfsavecontent too but it's not help me.
Could you any one help on this. Why it's was happen ? Thanks in advance.
Add type="html" to your cfmail tag. That should indicate to the end user's email client that the message should be displayed as an HTML page instead of just plain text.
I'm a little bit confused by the configuration variable ACCOUNT_CONFIRM_EMAIL_ON_GET. (docs)
If a user clicks on an activation link in an email, wouldn't the request have to be a get request? (Surely I'm wrong or missing something).
From my testing, if I leave ACCOUNT_CONFIRM_EMAIL_ON_GET set to False, when I click on the activation link from my email my account does not get activated. What am I missing here?
When a user is registered an url to confirm the e-mail address is generated. Eg:
http://www.example.com/accounts/confirm-email/iq4ma0qw6fqazui7ilwd4b3vftg/
With ACCOUNT_CONFIRM_EMAIL_ON_GET set to True the user will confirm the e-mail just by clicking the link. This happens because by clicking on the link, he will request the url (GET) and therefore, allauth will mark the e-mail address as confirmed because a GET for this url was received.
With ACCOUNT_CONFIRM_EMAIL_ON_GET set to False, when the user clicks on the link, a page will be loaded where there will be a button "Confirm e-mail address" or something like this. Then the user has to click on that button that will generate a POST request that will confirm the e-mail. This happens because allauth will mark the e-mail address as confirmed only on POST and not on GET requests to the e-mail confirmation url.
If you take a look at the source, you can see that the arguments passed to the view from the URL will be redirected to the post() method, meaning the user will not see a confirmation screen.
https://github.com/pennersr/django-allauth/blob/master/allauth/account/views.py#L213
Can anyone tell me how to send a mail from plone site. What i m trying to do is(will list out my points)
i have a template page(html page) called contact us.In which the user can enter his/her name, email id, address, etc. After entering the things he have to submit it to a particular mail id.
I create a .py file for getting those values from contact us html page.
After getting the values, it should be mailed to a particular mail id.
my html page somewhat looks like like:
<html>
<form action="mailto" method = "post" name="mailto">
Name :<input type="text" name="fname" />
address :<input type="text" name="address"/>
</form>
</html>
mailto.py
class MailTo(BrowserView)
def __init__(self,context,request):
self.context = context
self.request = request
def registerdetail(self):
mailhost = self.context.MailHost
form= self.request.form
name=form.get('fname')
address=form.get('address')
mto = 'xxxx#gmail.com'
msg="""
Name:%s
Address:%s
""" %(name,address)
mailhost.send(messageText=msg, mto=mto, mfrom='yyy#yahoo.com')
return self.sucesspage()
I tested it directly by giving my own mailid in "mto=gsgfsf#gmail.com" but i didnit receive any mail. can anyone tell whats wrong with my things.
Thanks in advance
You'll find it much easier to simply use PloneFormGen (a popular add-on for Plone) to build your form. You can make the email destination for the form configurable by following the instructions at: http://developer.plone.org/reference_manuals/active/ploneformgen/select_mail.html
According to what you say on the mailing lists, your problem is that you installed the developer tool Products.PrintingMailHost.
With that installed emails are printed to the console instead of being sent. This is so you can test sending emails without actually having to send emails.
Verify you have configured Plone to send mail first. In Site Setup -> Mail, enter your mail server information and click Save and Send test e-mail.
Then using MailHost in Python should work (unless you are using Products.PrintingMailHost which prints email instead of sending it.)