mrrlg Posted May 1, 2006 Share Posted May 1, 2006 Is there a way to have multiple recipients within the $s_ToAddress field within this script? #include <INet.au3> $s_SmtpServer = "10.X.X.X" $s_FromName = "my name" $s_FromAddress = "myname@sna.com" $s_ToAddress = "User1@sna.com" $s_Subject = "My Test SMTP" Dim $as_Body[2] $as_Body[0] = "Testing the new email alerts" $as_Body[1] = "Sent through Auto It" $Response = _INetSmtpMail ($s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress, $s_Subject, $as_Body) $err = @error If $Response = 1 Then MsgBox(0, "Success!", "Mail sent") Else MsgBox(0, "Error!", "Mail failed with error code " & $err) EndIf Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted May 1, 2006 Moderators Share Posted May 1, 2006 (edited) Could have swore you asked this question already: http://www.autoitscript.com/forum/index.ph...ndpost&p=178234Edit:This might work, (Untested, but you'll get the idea)#include <INet.au3> $ToAddresses = 'Someone1@another.com,Someone2@another.com' $ToAddresses = StringSplit($ToAddresses, ',') Local $Body[2] = ['Testing the new email alerts', 'Sent through AutoIt'] _SendMultiple("10.X.X.X", "my name", "myname@sna.com", $ToAddresses, 'Have you heard?', $Body) Func _SendMultiple($s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress, $s_Subject, $as_Body) If IsArray($s_FromAddress) Then For $icount = 1 To UBound($s_FromAddress) - 1 If _INetSmtpMail ($s_SmtpServer, $s_FromName, $s_FromAddress[$icount], $s_ToAddress, $s_Subject, $as_Body) Then MsgBox(0, "Success!", "Mail sent") Else MsgBox(0, "Error!", "Mail failed with error code " & @error) EndIf Next Else If _INetSmtpMail ($s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress, $s_Subject, $as_Body) Then MsgBox(0, "Success!", "Mail sent") Else MsgBox(0, "Error!", "Mail failed with error code " & @error) EndIf EndIf EndFunc Edited May 1, 2006 by SmOke_N Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
GaryFrost Posted May 1, 2006 Share Posted May 1, 2006 try semi-colon between address', i.e. $s_ToAddress = "User1@sna.com;your_e-mail@my.com" replace your_e-mail@my.com with the addy you want to send to SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference. Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted May 3, 2006 Moderators Share Posted May 3, 2006 @mrrlg - did either of these options work, or did you find another alternative? Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
mrrlg Posted May 3, 2006 Author Share Posted May 3, 2006 When I insert a semi colon that stops the script at that portion of the line and any addresses behind that are not picked up. I tried using a / in front of the ; as an escape and that did not work. I also tried your second suggestion and the script fails as the $s_ToAddress does not resolve to $s_ToAddresses. In the end I created a mail group in the server and use that as the email account called for in the script. Now I can notify multiple users using this script. Link to comment Share on other sites More sharing options...
greenmachine Posted May 4, 2006 Share Posted May 4, 2006 When I insert a semi colon that stops the script at that portion of the line and any addresses behind that are not picked up. I tried using a / in front of the ; as an escape and that did not work. I also tried your second suggestion and the script fails as the $s_ToAddress does not resolve to $s_ToAddresses.In the end I created a mail group in the server and use that as the email account called for in the script. Now I can notify multiple users using this script.Did you put the string in quotes as shown by gafrost? The semi-colon is used for comments in AutoIt, so without quotes it is commenting out the rest of the line. With quotes surrounding the string, the semi-colon is included as part of the string. Link to comment Share on other sites More sharing options...
mrrlg Posted May 4, 2006 Author Share Posted May 4, 2006 I was able to string together multiple addresses within the quotation marks and using the script suggested by SmOke_N and I do get a Successful Mail Sent response. The trouble is, the smtp server does not receive anything when I examine all the queues. My messages are wandering around in LAN cyberspace somewhere. I will keep playing around with the script to see if I can get it to work. 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