How to send email html template in SIDDHI IO EMAIL? - wso2

I am using siddhi with WSO2.
In siddhi email there is an option that says that is posible to send html. According to this I suppose there is a way to send template html. I want these because I need a more frindly email than just the event in plain txt.
Or something to change the body of the email.
#source(type='email', #map(type='xml'), username='receiver.account', password='account.password',content.type='text/html,)
define stream inputStream (name string, age int, country string);
Up to now I haven't found a way to add the html or where to add it.

To send HTML email instead of #map(type='xml') use
#map(type = 'text', #payload("""
<html>
<body>
Hi {{name}} <br/>
Good luck with your email :)
</body>
</html>
"""))
with proper email tempate.

Related

Can I send requests to the server from HTML rendered in email?

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

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.

problem in sending html email using django

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?

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

Email template using XSLT

HI all,
I have an XML with the different email bodies. I am using xslt to prepare an email template for sending these emails. I also want to include <subject> tag to the xml so that the email is more maintainable.I am using spring to send mail. I need to set the body ans subject of the mail. Body of the mail i am setting by using xslt transformation. I want to set the subject too.Please help me out if you have any idea!! I don't want to use xml parsing just for setting subject.Is there any way i can get the subject value using xslt??
here is my xml:
<mailMessage>
<mail type="pinReset">
<subject>Regarding account pin reset</subject>
<body>
<prefix>Hello User You have initiated a pin reset Please click
on the link below to reset your pin</prefix>
<suffix>Thank you</suffix>
</body>
</mail>
<mail type="emailUpdate">
<subject>Regarding account email update</subject>
<body>
<prefix>emailupdated</prefix>
<suffix>thank u</suffix>
</body>
</mail>
<mail type="failureCount">
<subject>Regarding account unsuccessful login</subject>
<body>
<prefix>failureCount</prefix>
<suffix>thank u</suffix>
</body>
</mail>
</mailMessage>
I want to fetch the subject separately.
You could create a second, very simple XSLT template that only outputs the subject line.
You can pass the string value for the subject, and the mail type as parameters to the XSLT transformation, and the transformation can be written in such a way as to produce the whole email message.