Hi, all
I want to send emails using the mail plugin of Servoy and I’m having trouble with sending a message with html tags. What I really want to do is to send an inline image in the message and I found this tip but it didn’t work: http://www.mindfiresolutions.com/Adding-Inline-Images-to-the-body-of-your-mail-in-Servoy-359.php
I receive the mail like a normal text message with all my html text in it. What am I missing to do this??
Thanks, Andres
My message is:
<html><a href="http://www.infocomsa.com.ar/files/folleto_prode.html">Si no puede ver el mail correctamente, haga clic aqui</a></html>
<html><img src="%%folleto_prode.png%%"</html>
Hi Andres,
I tried this code and it worked for me.
if(plugins.mail){
var properties = new Array();
properties[0] = 'mail.smtp.host=smtp.gmail.com';
properties[1] = 'mail.smtp.port=587';
properties[2] = 'mail.smtp.auth=true';
properties[3] = 'mail.smtp.username=<yourID>@gmail.com';
properties[4] = 'mail.smtp.password=<your_password>';
properties[5] = 'mail.smtp.starttls.enable=true';
var attach1 = plugins.mail.createBinaryAttachment('flower1.jpg',plugins.file.readFile('c:/temp/flower1.jpg'));
var attach2 = plugins.mail.createBinaryAttachment('flower2.jpg',plugins.file.readFile('c:/temp/flower2.jpg'));
// Here is the HTML code you need to write.
var msgText = ' <HTML>This is some HTML Texts. Here, I am adding my image inline.'+
'
<IMG SRC="%% flower1.jpg %%">'+
'
My another image.'+
'
<IMG SRC="%% flower2.jpg %%">'+
' </HTML>';
var success = plugins.mail.sendMail('sovanm@mindfiresolutions.com', <yourID>@gmail.com', 'Mail with HTML inline image', msgText,null,null,new Array(attach1, attach2),properties);
if(!success)
{
plugins.dialogs.showWarningDialog('Alert','Failed to send mail','OK');
} else {
plugins.dialogs.showWarningDialog('Alert','Success','OK');
}
}
I tried it with gmail SMTP settings.
Hope this helps you.
Thanks