Render django html text in email body format - django

Below is a field on my forms.py:
body = forms.CharField(label='Paste Email Thread Here',
widget=forms.Textarea(attrs={
"class": "body-QAerror",}))
And this is the data that I have entered:
Which I passed onto my html template; however, it didn't retain the email format (with indentions) See below:
From: Firstname, Lastname Sent: Wednesday, February 27, 2019 11:01 AM To: someonelese#example.com Subject: server is unresponsive Importance: High For some unknown reason, the server is not responsive – can’t log in, and affected all end users. I filed a ticket 123456. Please communicate this if some users are asking for the issue. Thanks, Firstname MiddleName 78456431 FM#example.com
Is it possible to still retain the email format?

HTML ignores whitespace. You'll need to convert those newlines to HTML tags.
There are built-in Django template filters to do this: linebreaks and linebreaksbr.
So you would do for example:
{{ email.body|linebreaks }}

Related

Anchor tag not act properly instead show full string inside cfemail content

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.

Microsoft Dynamics NAV 2009, Problem email attachment

In NAV 2009 when I try to send a quote my quote goes to attachment, not the email body. When I click Print then preview>>>file>>>send >>>Report by Email I see the quote in the email attachment but I want to the quote in the email body. How do I do this?

Sitecore Webform email issue

I am using sitecore Web Forms for Marketers 2.4.0 rev. 140117, It was working fine but we just noticed that emails are not working fine. Form contains save database and send email actions.
Form's information is saved correctly into database and email is also sent but email body is not replacing the values of the form fields.
here is the HTML generated by the form
Name * should have been replaced with the value entered in the name box but it is not happening, same problem with other fields.
Another issue is that "Insert Field" dropdown on the form is blank, does not contain any field.
<p><strong>Name: </strong>[<label id="{E8A4BF98-DE18-4DB7-B14D-E6DAD00F1872}">Name *</label>]</p>
<p><strong>Email:</strong> [<label id="{3E3DE00D-D804-47F4-AA51-69B7347C95C0}">Email *</label>]
</p>
<p><strong>Phone: </strong>[<label id="{BD908E77-C678-4A81-97DB-AD5D1FC81953}">Phone *</label>]</p>
<p><strong>Post Code:</strong> [<label id="{D6B91F3B-6EC7-4B3A-AE5F-F38ACD158AD8}">Post Code *</label>]</p>
<p><strong>Comments: </strong>[<label id="{0062519C-F761-4323-ADC6-D951734FBEC7}">Comment</label>]</p>
here is the generated email html
<p><strong>Name: </strong>[<label id=3D"{E8A4BF98-DE18=
-4DB7-B14D-E6DAD00F1872}">Name *</label>]</p>=0A<p><strong>Email:=
</strong> [<label id=3D"{3E3DE00D-D804-47F4-AA51-69B7347C95C0}">E=
mail *</label>]=0A</p>=0A<p><strong>Phone: </strong>[<label =
id=3D"{BD908E77-C678-4A81-97DB-AD5D1FC81953}">Phone *</label>]</p=
>=0A<p><strong>Post Code:</strong> [<label id=3D"{D6B91F3B-6EC7-4=
B3A-AE5F-F38ACD158AD8}">Post Code *</label>]</p>=0A<p><strong>Com=
ments: </strong>[<label id=3D"{0062519C-F761-4323-ADC6-D9517=
34FBEC7}">Comment</label>]</p>
Can you verify that your files are accurate? Start by comparing the dll's in your bin folder with a clean install of the Sitecore/Wffm version (especially wffm in this case). Things like this are often caused by dll's from an older version that get into the bin folder.

Sitecore WebForms for Marketers : send email to users

I am using Send Email Message action. I have added one action for send email to admin and another thank you mail to user who filled the form so my question is how I can add user email in Send Email Editor. I tried to add email Insert Field but it is not working.
EDIT:
By Default, the TO Dropdown only allows content from the Email Field Type. To allow other field types, please go to to the Send Email Message action found here by default: /sitecore/system/Modules/Web Forms for Marketers/Settings/Actions/Save Actions/Send Email Message
go to the Editor section, and enter the following into the QueryString field:
AllowedToTypes={84ABDA34-F9B1-4D3A-A69B-E28F39697069}|{YOUR CUSTOM FIELD TYPE GUID}
The first guid is for the standard Email Field type, and the second one will be your custom field. This should allow you to choose from those fields in the TO field.
For best practices, you should duplicate the Send Email Message action, and apply the changes there to prevent issues with future upgrades.
To allow your custom fields to be selectable for the CC and From fields as well, your query string would look like this:
AllowedToTypes={84ABDA34-F9B1-4D3A-A69B-E28F39697069}|{YOUR CUSTOM FIELD TYPE GUID}&AllowedCCTypes={84ABDA34-F9B1-4D3A-A69B-E28F39697069}|{YOUR CUSTOM FIELD TYPE GUID}&AllowedFromTypes={84ABDA34-F9B1-4D3A-A69B-E28F39697069}|{YOUR CUSTOM FIELD TYPE GUID}
From there, to send an email to one of the fields on the form, simply choose the field by clicking the little arrow next to the 'To' field
I have noticed a bug in previous version of wffm where it places double brackets around the field name, for example: [[email address]]. If you notice the double brackets [[..]], then erase the entire field and select it again as shown above.
I found there is an issue a with the To: field in certain browsers - not sure if this is related to Bug 402562.
In Chrome I get js error messages but in Firefox I can insert the email field with no issues.
As stated my #amir818, you need to add the field name with brackets in the To field. If you are using Chrome then the arrow may not work due to a javascript error, it works in IE though.
Alternate way to add the field into the message body from the Insert Field droplist and then copy+paste into the TO field. Looking at your field names it should be [Emailaddress].
The double brackets that amir mentioned is a bug, you can get a fix from Sitecore and quote ticket number 402562. When you edit the form again, the field has 2 sets of brackets added which then breaks the send action, e.g. it would end up as [[Emailaddress]] which is incorrect and therefore fails

how to send a mail from plone site

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