# Mail with HTML

**URL:** <https://forum.servoy.com/t/mail-with-html/17980>\
**Category:** Classic Servoy\
**Created:** [May 22, 2014, 5:39pm UTC](https://forum.servoy.com/t/mail-with-html/17980 "2014-05-22T17:39:03Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![andres\_achiary1363801637](https://avatars.discourse-cdn.com/v4/letter/a/b5a626/32.png) [@andres\_achiary1363801637](https://forum.servoy.com/u/andres_achiary1363801637)\
**Post date:** [May 22, 2014, 5:39pm UTC](https://forum.servoy.com/t/mail-with-html/17980/1 "2014-05-22T17:39:03Z")

</div>

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](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:

```auto
   <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>

```

---

<div class="post-metadata">

**Author:** ![sovanm](https://avatars.discourse-cdn.com/v4/letter/s/a183cd/32.png) [@sovanm](https://forum.servoy.com/u/sovanm)\
**Post date:** [May 23, 2014, 6:53am UTC](https://forum.servoy.com/t/mail-with-html/17980/2 "2014-05-23T06:53:44Z")

</div>

Hi Andres,

I tried this code and it worked for me.

```auto
	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
