Jump to content

HTML email - missing embedded image


Recommended Posts

Hi,
i have an AutoIT script that sends emails with two embedded images.
When users get the email they don't see the images. How should I fix my code?

Thank you for your support,
Amos

Func fSendMail()
    $TemplateName = StringRegExpReplace($Template, "^.*\\|\..*$", "")
    $SmtpServer = "smtp.**.com"
    $FromName = "do-not-reply@*********"
    $FromAddress = "do-not-reply@******"
    $ToAddress = $MG1_Mgr & ";"& $Owner
    $Subject = "ACTION REQUIRED - " & $TemplateName
    $Body = $sBody5
    $IPPort = 25
    $ssl = 0
    Global $oMyRet[2]
    Global $oMyError = ObjEvent("AutoIt.Error", "MyErrFunc")
    $rc = fINetSmtpMailCom($SmtpServer, $FromName, $FromAddress, $ToAddress, $Subject, $Body, $IPPort, $ssl)
    If @error Then
        MyErrFunc()
    EndIf
EndFunc;fSendMail

Func fINetSmtpMailCom($s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress, $s_Subject = "", $as_Body = "", $IPPort = 25, $ssl = 0)
    Local $objEmail = ObjCreate("CDO.Message")
    $objEmail.From = '"' & $s_FromName & '" <' & $s_FromAddress & '>'
    $objEmail.To = $s_ToAddress
    Local $i_Error = 0
    Local $i_Error_desciption = ""
    $objEmail.Subject = $s_Subject
    If StringInStr($as_Body, "<") And StringInStr($as_Body, ">") Then
        $objEmail.HTMLBody = $as_Body
    Else
        $objEmail.Textbody = $as_Body & @CRLF
    EndIf
    $objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
    $objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = $s_SmtpServer
    If Number($IPPort) = 0 Then $IPPort = 25
    $objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = $IPPort
    $objEmail.Configuration.Fields.Update
    $objEmail.Fields.Update
    ;$objEmail.Send ****************
    If @error Then
        MyErrFunc()
    EndIf
    $objEmail = ""
EndFunc;fINetSmtpMailCom

 

Link to comment
Share on other sites

  • Developers

I don't see any mentioning of embedded images in your posted code so it would help when you share an actual example that contains those.

Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

  • Developers

That page doesn't have embedded images but rather linked images which point to a local file.
Just download and safe the file and then open it. You will see the images aren't found as they point to ".\" ...eg:

<IMG style="HEIGHT: 151px; WIDTH: 358px; Z-INDEX: 0" border=0 hspace=0 alt="" 
      src=".\ILSILOGO.jpg" width=358 align=left height=152>

Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...