mein Posted April 26, 2007 Share Posted April 26, 2007 I have a need to automate the sending of documents to different addresses. The files will be created and kept in a single folder and then need to be sent to specific addresses depending on the name of the file. Is this something that can be done with autoit so that when I run a script it checks the folder then creates and sends the email? Any help would be appreciated. Link to comment Share on other sites More sharing options...
Zedna Posted April 26, 2007 Share Posted April 26, 2007 (edited) Look hereEDIT:here is my own simplified version (without error handling)Func _SendEmail($e_From, $e_To, $e_Subject, $e_Text, $e_attach = '') $objMessage = ObjCreate ("CDO.Message") If @error Then Return $objMessage.BodyPart.ContentTransferEncoding = "8bit" $objMessage.BodyPart.CharSet = "windows-1250" $objMessage.From = $e_From $objMessage.To = $e_To $objMessage.Subject = $e_Subject $objMessage.TextBody = $e_Text If $e_attach <> '' Then $objMessage.AddAttachment($e_attach) ; @ScriptDir & "\Test.txt" $objMessage.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2 $objMessage.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserver") = $ini_smtp_server $objMessage.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = $ini_smtp_port $objMessage.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 60 $objMessage.Configuration.Fields.Update $objMessage.Send $objMessage = 0 EndFunc Edited April 26, 2007 by Zedna Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
ScriptUSER Posted April 27, 2007 Share Posted April 27, 2007 Look here EDIT: here is my own simplified version (without error handling) Func _SendEmail($e_From, $e_To, $e_Subject, $e_Text, $e_attach = '') $objMessage = ObjCreate ("CDO.Message") If @error Then Return $objMessage.BodyPart.ContentTransferEncoding = "8bit" $objMessage.BodyPart.CharSet = "windows-1250" $objMessage.From = $e_From $objMessage.To = $e_To $objMessage.Subject = $e_Subject $objMessage.TextBody = $e_Text If $e_attach <> '' Then $objMessage.AddAttachment($e_attach) ; @ScriptDir & "\Test.txt" $objMessage.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2 $objMessage.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserver") = $ini_smtp_server $objMessage.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = $ini_smtp_port $objMessage.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 60 $objMessage.Configuration.Fields.Update $objMessage.Send $objMessage = 0 EndFunc Can i use this script by using username and password ? Link to comment Share on other sites More sharing options...
Zedna Posted April 27, 2007 Share Posted April 27, 2007 (edited) Can i use this script by using username and password ? No problem, look at link I posted above. JdeB's function has more options. My script is simplified as I said. ;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 Edited April 27, 2007 by Zedna Resources UDF ResourcesEx UDF AutoIt Forum Search 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