Jump to content

_INetSmtpMail sending Image within HTML Body


Recommended Posts

I wonder if there is a way to send pictures within html body that will be shown at the desition email.
Here is a test script
The sending HTM File with the needed image folder test-Dateien.7ztest.htm 

#include "Inet.au3"

Local $text = FileRead("E:\AutoIT\SMTP Messenger\test.htm")
Local $s_SmtpServer = "exchange2016.kanzlei.local"
Local $s_FromName = "Developer"
Local $s_FromAddress = "dev@kmp-gruppe.de"
Local $s_ToAddress = "a.klein@kmp-gruppe.de"
Local $s_Subject = "*SMTP HTML Test Ansicht*"
Local $as_Body[1]
$as_Body[0] = $text

Local $Response = _INetSmtpMail($s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress, $s_Subject, $as_Body, Default, -1)
Local $err = @error
If $Response = 1 Then
MsgBox(0, "Zugestellt!", "Mail erfolgreich zugestellt!")
Else
MsgBox(0, "Abbruch!", "Zustellung mit folgender Error ID abgebrochen: " & $err)
EndIf

I read a .htm file created with Microsoft Office Word.
Microsoft Outlook using the same extension for adding Signatures and surprisingly the recipient can see the image files within the text body without any problems.
If I send the same htm file with "_INetSmtpMail" it doesn't work and looks like this:

image.png.245a31e0ca9332f4d9296f41a2d59e65.png

Don't worry my inet.au3 is already modified to html so this can't be the problem.
I guess Outlook using some additional functions to make it possible.

$aSend[4] = "From:" & $sFromName & "<" & $sFromAddress & ">" & @CRLF & _
            "To:" & "<" & $sToAddress & ">" & @CRLF & _
            "Subject:" & $sSubject & @CRLF & _
            "Mime-Version: 1.0" & @CRLF & _
            "Date: " & _DateDayOfWeek(@WDAY, 1) & ", " & @MDAY & " " & _DateToMonth(@MON, 1) & " " & @YEAR & " " & @HOUR & ":" & @MIN & ":" & @SEC & $iBias & @CRLF & _
            "Content-Type: text/html; charset=ISO8859-1" & @CRLF & _
            @CRLF
    $aReplyCode[4] = ""

 

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

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...