Frankie70 Posted September 28, 2012 Share Posted September 28, 2012 Hello, first of all, sorry for my bad english... I have following problem: With this script I can send an eMail to one Receiver. The as_body text is full visible in the eMail: if $space > 10 Then Local $s_SmtpServer = "xxx" Local $s_FromName = "xxx" Local $s_FromAddress = "xxx" Local $s_ToAddress = "xxx" Local $s_Subject = "xxx" Local $as_Body[6] $as_Body[0] = "Computername: " & @ComputerName & " xxx" $as_Body[1] = "Domaene: " & @LogonDomain $as_Body[2] = "IP-Adresse: " & @IPAddress1 $as_Body[3] = "Festplattenkapazitaet gesamt: " & $var2 & " GB" $as_Body[4] = "Festplattenkapazitaet verfuegbar: " & $space2 & " GB" Local $Response = _INetSmtpMail($s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress, $s_Subject, $as_Body, @ComputerName, -1) For this I am using this inet.au3: expandcollapse popup#include-once #include "WinAPI.au3" #include "Date.au3" ; #INDEX# ======================================================================================================================= ; Title .........: Edit Constants ; AutoIt Version : 3.0 ; Language ......: English ; Description ...: Functions that assist with Internet. ; Author(s) .....: Larry, Ezzetabi, Jarvis Stubblefield, Wes Wolfe-Wolvereness, Wouter, Walkabout, Florian Fida ; Dll ...........: wininet.dll, ws2_32.dll ; =============================================================================================================================== ; #FUNCTION# ========================================================================================================= ; Name...........: _GetIP ; Description ...: Retrieves the Public IP Address of a Network/Computer. ; Syntax.........: _GetIP() ; Parameters ....: None ; Requirement(s).: v3.3.2.0 or higher ; Return values .: Success - Returns Public IP Address. ; Failure - Returns -1 & sets @error = 1 ; Author ........: guinness ; Example........; Yes ;===================================================================================================================== Func _GetIP() Local $aReturn, $bRead, $sRead $bRead = InetRead("http://checkip.dyndns.org/") $sRead = BinaryToString($bRead) $aReturn = StringRegExp($sRead, '(?s)(?i)Current IP Address: (.*?)', 3) If @error = 0 Then Return $aReturn[0] EndIf $bRead = InetRead("http://automation.whatismyip.com/n09230945.asp") ; http://forum.whatismyip.com/f14/our-automation-rules-t241/ $sRead = BinaryToString($bRead) If @error Then Return SetError(1, 0, -1) EndIf Return $sRead EndFunc ;==>_GetIP ; #FUNCTION# ==================================================================================================================== ; Name...........: _INetExplorerCapable ; Description ...: Convert a string to IE capable line ; Parameters ....: $s_IEString - String to convert to a capable IExplorer line ; Return values .: On Success - Returns the converted string ; On Failure - Blank String and @error = 1 ; Author ........: Wes Wolfe-Wolvereness ; =============================================================================================================================== Func _INetExplorerCapable($s_IEString) If StringLen($s_IEString) <= 0 Then Return SetError(1, 0, '') Local $s_IEReturn Local $n_IEChar For $i_IECount = 1 To StringLen($s_IEString) $n_IEChar = '0x' & Hex(Asc(StringMid($s_IEString, $i_IECount, 1)), 2) If $n_IEChar < 0x21 Or $n_IEChar = 0x25 Or $n_IEChar = 0x2f Or $n_IEChar > 0x7f Then $s_IEReturn = $s_IEReturn & '%' & StringRight($n_IEChar, 2) Else $s_IEReturn = $s_IEReturn & Chr($n_IEChar) EndIf Next Return $s_IEReturn EndFunc ;==>_INetExplorerCapable ; #FUNCTION# ==================================================================================================================== ; Name...........: _INetGetSource ; Description ...: Gets the source from an URL without writing a temp file. ; Parameters ....: $s_URL - The URL of the site. ; $bString - If True the data is returned in string format, otherwise binary format. ; Return values .: Success - The read string and sets @extended to the number of bytes returned. ; Failure - An empty string and and sets @error to non-zero. ; Author ........: Wouter van Kesteren. ; =============================================================================================================================== Func _INetGetSource($s_URL, $bString = True) Local $sString = InetRead($s_URL, 1) Local $nError = @error, $nExtended = @extended If $bString Then $sString = BinaryToString($sString) Return SetError($nError, $nExtended, $sString) EndFunc ;==>_INetGetSource ; #FUNCTION# ==================================================================================================================== ; Name...........: _INetMail ; Description ...: Open default mail client with given Address/Subject/Body ; Parameters ....: $s_MailTo - Address for E-Mail ; $s_Subject - Subject of E-Mail ; $s_MailBody - Body of E-Mail ; Return values .: On Success - Process ID of e-mail client ; On Failure - Returns 0 and sets @error to non-zero. ; Author ........: Wes Wolfe-Wolvereness , modified by Emiel Wieldraaijer ; =============================================================================================================================== Func _INetMail($s_MailTo, $s_MailSubject, $s_MailBody) Local $prev = Opt("ExpandEnvStrings", 1) Local $var, $dflt = RegRead('HKCU\Software\Clients\Mail', "") If $dflt = "Windows Live Mail" Then $var = RegRead('HKCR\WLMail.Url.Mailto\Shell\open\command', "") Else $var = RegRead('HKCR\mailto\shell\open\command', "") EndIf Local $ret = Run(StringReplace($var, '%1', _INetExplorerCapable('mailto:' & $s_MailTo & '?subject=' & $s_MailSubject & '&body=' & $s_MailBody))) Local $nError = @error, $nExtended = @extended Opt("ExpandEnvStrings", $prev) Return SetError($nError, $nExtended, $ret) EndFunc ;==>_INetMail ; #FUNCTION# ==================================================================================================================== ; Name...........: _INetSmtpMail ; Description ...: Sends an email using SMTP over TCP IP. ; Parameters ....: $s_SmtpServer - SMTP server to be used for sending email ; $s_FromName - Name of sender ; $s_FromAddress - eMail address of sender ; $s_ToAddress - Address that email is to be sent to ; $s_Subject - Subject of eMail ; $as_Body - Single dimension array containing the body of eMail as strings ; $s_helo - Helo identifier (default @COMPUTERNAME) sometime needed by smtp server ; $s_first - send before Helo identifier (default @CRLF) sometime needed by smtp server ; $b_trace - trace on a splash window (default 0 = no trace) ; Return values .: On Success - Returns 1 ; On Failure - 0 and sets ; @ERROR = 1 - Invalid Parameters ; @ERROR = 2 - Unable to start TCP ; @ERROR = 3 - Unable to resolve IP ; @ERROR = 4 - Unable to create socket ; @ERROR = 5x - Cannot open SMTP session ; @ERROR = 50x - Cannot send body ; @ERROR = 5000 - Cannot close SMTP session ; Author ........: Asimzameer, Walkabout ; Modified.......: Jpm ; =============================================================================================================================== Func _INetSmtpMail($s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress, $s_Subject = "", $as_Body = "", $s_helo = "", $s_first = " ", $b_trace = 0) If $s_SmtpServer = "" Or $s_FromAddress = "" Or $s_ToAddress = "" Or $s_FromName = "" Or StringLen($s_FromName) > 256 Then Return SetError(1, 0, 0) If $s_helo = "" Then $s_helo = @ComputerName If TCPStartup() = 0 Then Return SetError(2, 0, 0) Local $s_IPAddress, $i_Count StringRegExp($s_SmtpServer, "(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)") If @extended Then $s_IPAddress = $s_SmtpServer Else $s_IPAddress = TCPNameToIP($s_SmtpServer) EndIf If $s_IPAddress = "" Then TCPShutdown() Return SetError(3, 0, 0) EndIf Local $v_Socket = TCPConnect($s_IPAddress, 25) If $v_Socket = -1 Then TCPShutdown() Return SetError(4, 0, 0) EndIf Local $s_Send[6], $s_ReplyCode[6] ; Return code from SMTP server indicating success $s_Send[0] = "HELO " & $s_helo & @CRLF If StringLeft($s_helo, 5) = "EHLO " Then $s_Send[0] = $s_helo & @CRLF $s_ReplyCode[0] = "250" $s_Send[1] = "MAIL FROM: <" & $s_FromAddress & ">" & @CRLF $s_ReplyCode[1] = "250" $s_Send[2] = "RCPT TO: <" & $s_ToAddress & ">" & @CRLF $s_ReplyCode[2] = "250" $s_Send[3] = "DATA" & @CRLF $s_ReplyCode[3] = "354" Local $aResult = _Date_Time_GetTimeZoneInformation() Local $bias = -$aResult[1] / 60 Local $biasH = Int($bias) Local $biasM = 0 If $biasH <> $bias Then $biasM = Abs($bias - $biasH) * 60 $bias = StringFormat(" (%+.2d%.2d)", $biasH, $biasM) $s_Send[4] = "From:" & $s_FromName & "<" & $s_FromAddress & ">" & @CRLF & _ "To:" & "<" & $s_ToAddress & ">" & @CRLF & _ "Subject:" & $s_Subject & @CRLF & _ "Mime-Version: 1.0" & @CRLF & _ "Date: " & _DateDayOfWeek(@WDAY, 1) & ", " & @MDAY & " " & _DateToMonth(@MON, 1) & " " & @YEAR & " " & @HOUR & ":" & @MIN & ":" & @SEC & $bias & @CRLF & _ "Content-Type: text/plain; charset=US-ASCII" & @CRLF & _ @CRLF $s_ReplyCode[4] = "" $s_Send[5] = @CRLF & "." & @CRLF $s_ReplyCode[5] = "250" ; open stmp session If __SmtpSend($v_Socket, $s_Send[0], $s_ReplyCode[0], $b_trace, "220", $s_first) Then Return SetError(50, 0, 0) ; send header For $i_Count = 1 To UBound($s_Send) - 2 If __SmtpSend($v_Socket, $s_Send[$i_Count], $s_ReplyCode[$i_Count], $b_trace) Then Return SetError(50 + $i_Count, 0, 0) Next ; send body records (a record can be multiline : take care of a subline beginning with a dot should be ..) For $i_Count = 0 To UBound($as_Body) - 1 ; correct line beginning with a dot If StringLeft($as_Body[$i_Count], 1) = "." Then $as_Body[$i_Count] = "." & $as_Body[$i_Count] If __SmtpSend($v_Socket, $as_Body[$i_Count] & @CRLF, "", $b_trace) Then Return SetError(500 + $i_Count, 0, 0) Next ; close the smtp session $i_Count = UBound($s_Send) - 1 If __SmtpSend($v_Socket, $s_Send[$i_Count], $s_ReplyCode[$i_Count], $b_trace) Then Return SetError(5000, 0, 0) TCPCloseSocket($v_Socket) TCPShutdown() Return 1 EndFunc ;==>_INetSmtpMail ; #INTERNAL_USE_ONLY# =========================================================================================================== ; Name...........: __SmtpTrace ; Description ...: Used internally within this file, not for general use ; Syntax.........: __SmtpTrace($str[, $timeout = 0]) ; Author ........: Asimzameer, Walkabout ; Modified.......: Jpm ; =============================================================================================================================== Func __SmtpTrace($str, $timeout = 0) Local $W_TITLE = "SMTP trace" Local $s_SmtpTrace = ControlGetText($W_TITLE, "", "Static1") $str = StringLeft(StringReplace($str, @CRLF, ""), 70) $s_SmtpTrace &= @HOUR & ":" & @MIN & ":" & @SEC & " " & $str & @LF If WinExists($W_TITLE) Then ControlSetText($W_TITLE, "", "Static1", $s_SmtpTrace) Else SplashTextOn($W_TITLE, $s_SmtpTrace, 400, 500, 500, 100, 4 + 16, "", 8) EndIf If $timeout Then Sleep($timeout * 1000) EndFunc ;==>__SmtpTrace ; #INTERNAL_USE_ONLY# =========================================================================================================== ; Name...........: __SmtpSend ; Description ...: Used internally within this file, not for general use ; Syntax.........: __SmtpSend($v_Socket, $s_Send, $s_ReplyCode, $b_trace[, $s_IntReply=""[, $s_first=""]]) ; Author ........: Asimzameer, Walkabout ; Modified.......: Jpm ; =============================================================================================================================== Func __SmtpSend($v_Socket, $s_Send, $s_ReplyCode, $b_trace, $s_IntReply = "", $s_first = "") Local $s_Receive, $i, $timer If $b_trace Then __SmtpTrace($s_Send) If $s_IntReply <> "" Then ; Send special first char to awake smtp server If $s_first <> -1 Then If TCPSend($v_Socket, $s_first) = 0 Then TCPCloseSocket($v_Socket) TCPShutdown() Return 1; cannot send EndIf EndIf ; Check intermediate reply before HELO acceptation $s_Receive = "" $timer = TimerInit() While StringLeft($s_Receive, StringLen($s_IntReply)) <> $s_IntReply And TimerDiff($timer) < 45000 $s_Receive = TCPRecv($v_Socket, 1000) If $b_trace And $s_Receive <> "" Then __SmtpTrace("intermediate->" & $s_Receive) WEnd EndIf ; Send string. If TCPSend($v_Socket, $s_Send) = 0 Then TCPCloseSocket($v_Socket) TCPShutdown() Return 1; cannot send EndIf $timer = TimerInit() $s_Receive = "" While $s_Receive = "" And TimerDiff($timer) < 45000 $i += 1 $s_Receive = TCPRecv($v_Socket, 1000) If $s_ReplyCode = "" Then ExitLoop WEnd If $s_ReplyCode <> "" Then ; Check replycode If $b_trace Then __SmtpTrace($i & " <- " & $s_Receive) If StringLeft($s_Receive, StringLen($s_ReplyCode)) <> $s_ReplyCode Then TCPCloseSocket($v_Socket) TCPShutdown() If $b_trace Then __SmtpTrace("<-> " & $s_ReplyCode, 5) Return 2; bad receive code EndIf EndIf Return 0 EndFunc ;==>__SmtpSend ; #FUNCTION# ==================================================================================================================== ; Name...........: _TCPIpToName ; Description ...: Resolves IP adress to Hostname ; Syntax ........: _TCPIpToName($sIp, [[$iOption = 0], $hDll_Ws2_32 = "ws2_32.dll"]]) ; Parameters ....: $sIp - Ip Adress in dotted (v4) Format ; $iOption - Optional, Default = 0 ; 0 = Return String Hostname ; 1 = Return Array (see Notes) ; $hDll_Ws2_32 - Optional, Handle to ws2_32.dll ; Return values .: On Success - Hostname or Array (see Notes) ; On Failure - "" and Set ; @ERROR to: 1 - inet_addr DllCall Failed ; 2 - inet_addr Failed ; 3 - gethostbyaddr DllCall Failed ; 4 - gethostbyaddr Failed, WSAGetLastError = @Extended ; 5 - gethostbyaddr Failed, WSAGetLastError Failed ; 6 - strlen/sZStringRead Failed ; 7 - Error reading Aliases Array ; Author ........: Florian Fida ; Remarks .......: A successfull WSAStartup (Done by TCPStartup) is required. ; if $iOption = 1 then the returned Array looks Like this: ; $aResult[0] = Number of elemets ; $aResult[1] = "Hostname" ; $aResult[2] = "Alias 1" ; $aResult[3] = "Alias 2" ; ... ; =============================================================================================================================== Func _TCPIpToName($sIp, $iOption = Default, $hDll_Ws2_32 = Default) Local $INADDR_NONE = 0xffffffff, $AF_INET = 2, $sSeparator = @CR If $iOption = Default Then $iOption = 0 If $hDll_Ws2_32 = Default Then $hDll_Ws2_32 = "ws2_32.dll" Local $vaDllCall = DllCall($hDll_Ws2_32, "ulong", "inet_addr", "STR", $sIp) If @error Then Return SetError(1, 0, "") ; inet_addr DllCall Failed Local $vbinIP = $vaDllCall[0] If $vbinIP = $INADDR_NONE Then Return SetError(2, 0, "") ; inet_addr Failed $vaDllCall = DllCall($hDll_Ws2_32, "ptr", "gethostbyaddr", "ptr*", $vbinIP, "int", 4, "int", $AF_INET) If @error Then Return SetError(3, 0, "") ; gethostbyaddr DllCall Failed Local $vptrHostent = $vaDllCall[0] If $vptrHostent = 0 Then $vaDllCall = DllCall($hDll_Ws2_32, "int", "WSAGetLastError") If @error Then Return SetError(5, 0, "") ; gethostbyaddr Failed, WSAGetLastError Failed Return SetError(4, $vaDllCall[0], "") ; gethostbyaddr Failed, WSAGetLastError = @Extended EndIf Local $vHostent = DllStructCreate("ptr;ptr;short;short;ptr", $vptrHostent) Local $sHostnames = __TCPIpToName_szStringRead(DllStructGetData($vHostent, 1)) If @error Then Return SetError(6, 0, $sHostnames) ; strlen/sZStringRead Failed If $iOption = 1 Then Local $vh_aliases $sHostnames &= $sSeparator For $i = 0 To 63 ; up to 64 Aliases $vh_aliases = DllStructCreate("ptr", DllStructGetData($vHostent, 2) + ($i * 4)) If DllStructGetData($vh_aliases, 1) = 0 Then ExitLoop ; Null Pointer $sHostnames &= __TCPIpToName_szStringRead(DllStructGetData($vh_aliases, 1)) If @error Then SetError(7) ; Error reading array ExitLoop EndIf Next Return StringSplit(StringStripWS($sHostnames, 2), @CR) Else Return $sHostnames EndIf EndFunc ;==>_TCPIpToName ; #INTERNAL_USE_ONLY# =========================================================================================================== ; Name...........: __TCPIpToName_szStringRead ; Description ...: Used internally within this file, not for general use ; Syntax.........: __TCPIpToName_szStringRead($iszPtr[, $iLen = -1]) ; Author ........: Florian Fida ; =============================================================================================================================== Func __TCPIpToName_szStringRead($iszPtr, $iLen = -1) Local $vszString If $iszPtr < 1 Then Return "" ; Null Pointer If $iLen < 0 Then $iLen = _WinAPI_StringLenA($iszPtr) $vszString = DllStructCreate("char[" & $iLen & "]", $iszPtr) If @error Then Return SetError(2, 0, "") Return SetExtended($iLen, DllStructGetData($vszString, 1)) EndFunc ;==>__TCPIpToName_szStringRead If I take following inet.au3 to have a cc-receiver, the eMail will send to all receivers, but the eMail has not any text (only in the subject): expandcollapse popup; ;################################## ; Include ;################################## #Include ;################################## ; Variables ;################################## $SmtpServer = "" ; address for the smtp-server to use - REQUIRED $FromName = "" ; name from who the email was sent $FromAddress = "" ; address from where the mail should come $ToAddress = "" ; destination address of the email - REQUIRED $Subject = "" ; 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 = "" ; address for cc - leave blank if not needed $BccAddress = "" ; address for bcc - leave blank if not needed $Importance = "" ; 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 & '" <' & $s_FromAddress & '>' $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, "<") And 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 By using the above inet.au3 my script looks like: Local $SmtpServer = "mail.sls-kg.de" Local $SmtpServer = "xxx" Local $FromName = "xxx" Local $FromAddress = "xxx" Local $ToAddress = "xxx" Local $Subject = "xxx" Local $as_Body[6] $as_Body[0] = "Computername: " & @ComputerName & " xxx" $as_Body[1] = "Domaene: " & @LogonDomain $as_Body[2] = "IP-Adresse: " & @IPAddress1 $as_Body[3] = "Festplattenkapazitaet gesamt: " & $var2 & " GB" $as_Body[4] = "Festplattenkapazitaet verfuegbar: " & $space2 & " GB" Local $Response = _INetSmtpMailCom($SmtpServer, $FromName, $FromAddress, $ToAddress, $Subject, $as_Body, $AttachFiles, $CcAddress, $BccAddress, $Importance, $Username, $Password, $IPPort, $ssl) Any ideas what I am doing wrong? Many thanks in advance... Link to comment Share on other sites More sharing options...
hannes08 Posted September 28, 2012 Share Posted September 28, 2012 Your second UDF expects the Body to be a sting and not an array Regards,Hannes[spoiler]If you can't convince them, confuse them![/spoiler] Link to comment Share on other sites More sharing options...
water Posted September 28, 2012 Share Posted September 28, 2012 I'm not 100% sure but I think with _INetSmtpMail you can pass a string of recipients separated by ";" My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki  Link to comment Share on other sites More sharing options...
hannes08 Posted September 28, 2012 Share Posted September 28, 2012 UDF1: ; $as_Body - Single dimension array containing the body of eMail as strings UDF2: $Body = "" ; the messagebody from the mail - can be left blank but then you get a blank mail Regards,Hannes[spoiler]If you can't convince them, confuse them![/spoiler] Link to comment Share on other sites More sharing options...
Frankie70 Posted September 28, 2012 Author Share Posted September 28, 2012 Your second UDF expects the Body to be a sting and not an array Ok, so what I have to do now? Sorry, I am not really an expert... I'm not 100% sure but I think with _INetSmtpMail you can pass a string of recipients separated by ";"Already tested - doesn´t work... Link to comment Share on other sites More sharing options...
hannes08 Posted September 28, 2012 Share Posted September 28, 2012 (edited) Easy: Replace Local $as_Body[6] $as_Body[0] = "Computername: " & @ComputerName & " xxx" $as_Body[1] = "Domaene: " & @LogonDomain $as_Body[2] = "IP-Adresse: " & @IPAddress1 $as_Body[3] = "Festplattenkapazitaet gesamt: " & $var2 & " GB" $as_Body[4] = "Festplattenkapazitaet verfuegbar: " & $space2 & " GB" With Local $s_Body $s_Body &= "Computername: " & @ComputerName & " xxx" & @CRLF $s_Body &= "Domaene: " & @LogonDomain & @CRLF $s_Body &= "IP-Adresse: " & @IPAddress1 & @CRLF $s_Body &= "Festplattenkapazitaet gesamt: " & $var2 & " GB" & @CRLF $s_Body &= "Festplattenkapazitaet verfuegbar: " & $space2 & " GB" & @CRLF Edited September 28, 2012 by hannes08 Regards,Hannes[spoiler]If you can't convince them, confuse them![/spoiler] Link to comment Share on other sites More sharing options...
Frankie70 Posted September 28, 2012 Author Share Posted September 28, 2012 Many many thanks Hannes, it works now perfectly including changing in $Response the $as_Body to $s_Body... Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now