use COM API to send an email with embedded image attachment

Use this forum if you have problems with a hMailServer script, such as hMailServer WebAdmin or code in an event handler.
Post Reply
Thomas Parvais
Normal user
Normal user
Posts: 111
Joined: 2004-12-17 12:21

use COM API to send an email with embedded image attachment

Post by Thomas Parvais » 2012-02-12 23:23


I've migrate my complete server to win2008 R2 64.

Hmailserver migration went fine.

Some of my websites were using Dimac JMAIL on my previous server (2003 32bit) to send mails (ASP) tvia hmailserver

As I can't get Jmail working working fine on this Win2008-64 bits (conflict with isapi url rewriting from helicon) , I 'm trying to replace Jmail by Hmailserver COM API.

It seems very easy. here is my code :

Code: Select all

Option explicit
dim oApp,oMessage
set oApp = CreateObject("hMailServer.Application")
Call oApp.Authenticate("login", "password")
Set oMessage = CreateObject("hMailServer.Message")
	oMessage.From = ""
	oMessage.AddRecipient "Administrateur",""
	oMessage.Subject = "test a" 
	oMessage.Body = oMessage.Body & "envoyé !"
	oMessage.HTMLBody = "<h1>test titre H1</h1>"
set oMessage = nothing
set oApp = Nothing
But How can I use the embedded image (email attachment) in my HTMLBody ?

on jmail, the code was:

Code: Select all

...contentId = jmail.AddAttachment( Request.ServerVariables( "APPL_PHYSICAL_PATH" ) & "img\logo3.gif")
jmail.appendHTML "	<img src=""cid:" & contentId & """ border=""0"" alt=""Droit & Technologies""/>"
is this possible with hmailserver api ?

Thank you
Interrested by Law & new technologies ?
Intéressé par le droit de l'internet et des nouvelles technologies ?

Post Reply