Wenn Du die erlaubten Tags verwendest, sollte das mit dem Quellcode darstellbar sein (code, pre).
Folgendes Beispiel ist von „Autoscriptforum.com“ und funktioniert. Leider kann man an Deinem Beispiel nicht gut erkennen was falsch sein könnte. z. B. weiß ich nicht ob Die Anführungszeichen von Dir absichtlich weggelassen wurde oder nicht.
Ich hoffe das Beispiel hilft Dir weiter.
;
;##################################
; Include
;##################################
#Include
;##################################
; Variables
;##################################
$SmtpServer = "MailServer" ; address for the smtp-server to use - REQUIRED
$FromName = "Name" ; name from who the email was sent
$FromAddress = "[email protected]" ; address from where the mail should come
$ToAddress = "[email protected]" ; destination address of the email - REQUIRED
$Subject = "Userinfo" ; subject from the email - can be anything you want it to be
$Body = "" ; the messagebody from the mail - can be left blank but then you get a blank mail
$AttachFiles = "" ; the file(s) you want to attach seperated with a ; (Semicolon) - leave blank if not needed
$CcAddress = "[email protected]" ; address for cc - leave blank if not needed
$BccAddress = "[email protected]" ; address for bcc - leave blank if not needed
$Importance = "Normal" ; Send message priority: "High", "Normal", "Low"
$Username = "\*\*\*\*\*\*" ; username for the account used from where the mail gets sent - REQUIRED
$Password = "\*\*\*\*\*\*\*\*" ; password for the account used from where the mail gets sent - REQUIRED
$IPPort = 25 ; port used for sending the mail
$ssl = 0 ; enables/disables secure socket layer sending - put to 1 if using httpS
;~ $IPPort=465 ; GMAIL port used for sending the mail
;~ $ssl=1 ; GMAILenables/disables secure socket layer sending - put to 1 if using httpS
;##################################
; Script
;##################################
Global $oMyRet[2]
Global $oMyError = ObjEvent("AutoIt.Error", "MyErrFunc")
$rc = \_INetSmtpMailCom($SmtpServer, $FromName, $FromAddress, $ToAddress, $Subject, $Body, $AttachFiles, $CcAddress, $BccAddress, $Importance, $Username, $Password, $IPPort, $ssl)
If @error Then
MsgBox(0, "Error sending message", "Error code:" & @error & " Description:" & $rc)
EndIf
;
; The UDF
Func \_INetSmtpMailCom($s\_SmtpServer, $s\_FromName, $s\_FromAddress, $s\_ToAddress, $s\_Subject = "", $as\_Body = "", $s\_AttachFiles = "", $s\_CcAddress = "", $s\_BccAddress = "", $s\_Importance="Normal", $s\_Username = "", $s\_Password = "", $IPPort = 25, $ssl = 0)
Local $objEmail = ObjCreate("CDO.Message")
$objEmail.From = '"' & $s\_FromName & '" '
$objEmail.To = $s\_ToAddress
Local $i\_Error = 0
Local $i\_Error\_desciption = ""
If $s\_CcAddress "" Then $objEmail.Cc = $s\_CcAddress
If $s\_BccAddress "" Then $objEmail.Bcc = $s\_BccAddress
$objEmail.Subject = $s\_Subject
If StringInStr($as\_Body, "") Then
$objEmail.HTMLBody = $as\_Body
Else
$objEmail.Textbody = $as\_Body & @CRLF
EndIf
If $s\_AttachFiles "" Then
Local $S\_Files2Attach = StringSplit($s\_AttachFiles, ";")
For $x = 1 To $S\_Files2Attach[0]
$S\_Files2Attach[$x] = \_PathFull($S\_Files2Attach[$x])
;~ ConsoleWrite('@@ Debug : $S\_Files2Attach[$x] = ' & $S\_Files2Attach[$x] & @LF & '\>Error code: ' & @error & @LF) ;### Debug Console
If FileExists($S\_Files2Attach[$x]) Then
ConsoleWrite('+\> File attachment added: ' & $S\_Files2Attach[$x] & @LF)
$objEmail.AddAttachment($S\_Files2Attach[$x])
Else
ConsoleWrite('!\> File not found to attach: ' & $S\_Files2Attach[$x] & @LF)
SetError(1)
Return 0
EndIf
Next
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
;Authenticated SMTP
If $s\_Username "" Then
$objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1
$objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusername") = $s\_Username
$objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendpassword") = $s\_Password
EndIf
If $ssl Then
$objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = True
EndIf
;Update settings
$objEmail.Configuration.Fields.Update
; Set Email Importance
Switch $s\_Importance
Case "High"
$objEmail.Fields.Item ("urn:schemas:mailheader:Importance") = "High"
Case "Normal"
$objEmail.Fields.Item ("urn:schemas:mailheader:Importance") = "Normal"
Case "Low"
$objEmail.Fields.Item ("urn:schemas:mailheader:Importance") = "Low"
EndSwitch
$objEmail.Fields.Update
; Sent the Message
$objEmail.Send
If @error Then
SetError(2)
Return $oMyRet[1]
EndIf
$objEmail=""
EndFunc ;==\>\_INetSmtpMailCom
;
;
; Com Error Handler
Func MyErrFunc()
$HexNumber = Hex($oMyError.number, 8)
$oMyRet[0] = $HexNumber
$oMyRet[1] = StringStripWS($oMyError.description, 3)
ConsoleWrite("### COM Error ! Number: " & $HexNumber & " ScriptLine: " & $oMyError.scriptline & " Description:" & $oMyRet[1] & @LF)
SetError(1); something to check for when this function returns
Return
EndFunc ;==\>MyErrFunc