Confuzzled Posted September 19, 2009 Share Posted September 19, 2009 I am seeing if it works sending a fake email to my real email address. Hope you can help me So you can spam all of us? Unlikely... Link to comment Share on other sites More sharing options...
Developers Jos Posted September 19, 2009 Author Developers Share Posted September 19, 2009 I still cannot get this working for some reason :SAny help appreciated.Use your proper GMail account EMail address as sender of the Email. Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Bru Posted October 1, 2009 Share Posted October 1, 2009 Nope, i do not want to spam you all. I just wanted to try and get it working. And @ Jos. I did use my real email address and password, it didn't work for some strange reason :S Ah well. [right][/right] Link to comment Share on other sites More sharing options...
Ioannis Posted October 25, 2009 Share Posted October 25, 2009 Hi can someone help me and tell me how can i add the delivery report,for i.e when an email is being read,then a delivery report is sent to the sender . Link to comment Share on other sites More sharing options...
wakummaci Posted November 16, 2009 Share Posted November 16, 2009 Hi. The script is working like a charm, but for some reason I can not use it as an integrated function. Any ideas how can I call it INSIDE a function? Any documentation about this is appreciated as well, but I didn't find any useful about functions in the help file. Link to comment Share on other sites More sharing options...
Developers Jos Posted November 17, 2009 Author Developers Share Posted November 17, 2009 Hi.The script is working like a charm, but for some reason I can not use it as an integrated function.Any ideas how can I call it INSIDE a function?Any documentation about this is appreciated as well, but I didn't find any useful about functions in the help file.Sounds like a generic question and nothing to do with this UDF.As long as you put this UDF on its own in your script you will be able to "call" it by specifying _InetSmtpMailCom(.....)Post your snippet on what you are trying when you have any issues so we can see what you are trying.Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Splash Posted December 3, 2009 Share Posted December 3, 2009 (edited) I downloaded AutoIt Beta and can't use this UDF. I used the following settings: $SmtpServer = "smtp.gmail.com" ; address for the smtp-server to use - REQUIRED $FromName = "Splash" ; name from who the email was sent $FromAddress = "blablabla@gmail.com" ; address from where the mail should come $ToAddress = "blablabla@yahoo.com" ; destination address of the email - REQUIRED $Subject = "Testing..." ; subject from the email - can be anything you want it to be $Body = "Just a little test." ; the messagebody from the mail - can be left blank but then you get a blank mail $AttachFiles = "" ; the file you want to attach- leave blank if not needed $CcAddress = "" ; address for cc - leave blank if not needed $BccAddress = "" ; address for bcc - leave blank if not needed $Importance = "Normal" ; Send message priority: "High", "Normal", "Low" $Username = "blablabla" ; username for the account used from where the mail gets sent - REQUIRED $Password = "blablabla" ; 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 $IPPort=587 ; GMAIL port used for sending the mail $ssl=1 ; GMAILenables/disables secure socket layer sending - put to 1 if using httpS I get these error: ### COM Error ! Number: 80020009 ScriptLine: 94 This UDF is still working??? Thanks in advance. Edited December 3, 2009 by Splash Automatic Update UDF - IP Address UDF - WinPcap AutoIt _FindDevice()[font="Verdana"][size="2"]AutoIt Spanish/Brasil/World community!!![/size][/font]Use you wanna a dot.tk domain please use my link: Link to comment Share on other sites More sharing options...
Developers Jos Posted December 3, 2009 Author Developers Share Posted December 3, 2009 Yes it still works. Install the comm handler as shown in the base example and check the error description. Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Splash Posted December 3, 2009 Share Posted December 3, 2009 Hummm... I try with other GMail account and works. Possible a problem with one of my GMail accounts. Thanks for this great UDF! Automatic Update UDF - IP Address UDF - WinPcap AutoIt _FindDevice()[font="Verdana"][size="2"]AutoIt Spanish/Brasil/World community!!![/size][/font]Use you wanna a dot.tk domain please use my link: Link to comment Share on other sites More sharing options...
EndFunc Posted December 15, 2009 Share Posted December 15, 2009 (edited) For the love of pete I can't get this too work with Gmail. I started a new Gmail account. I can use the same info in Outlook 2003 and it works fine. I can get the script to work with my smtp at my job not supplying username or password for smtp. But.... with Gmail I just get the error ### COM Error ! Number: 80020009 ScriptLine: 81 Description:The transport failed to connect to the server. Over and over again. Even at home I get the same problem. I've been trying for hours. I even have my own hosting and tried my own email accounts and still get the same error. Why can't I get it to work?? expandcollapse popup#include <INet.au3> #Include <File.au3> Global $oMyRet[2] Global $oMyError = ObjEvent("AutoIt.Error", "MyErrFunc") $s_SmtpServer = "smtp.gmail.com" ; address for the smtp-server to use - REQUIRED $s_FromName = "Some Person" ; name from who the email was sent $s_FromAddress = "myemail@gmail.com" ; address from where the mail should come $s_ToAddress = "someemail@email.com" ; destination address of the email - REQUIRED $s_Subject = "Email Test: " ; subject from the email - can be anything you want it to be $as_Body = "";"<html><FONT face='Times New Roman' size=4 color=#0000ff>This message was sent from the " & "Test Script" & @CR & @CR & "<Div><BR>OS Ver: " & @OSVersion & " </Div><BR>" & @CR & @CR & _ ;"<Div> Description: <BR>" & "Testing Email" & @CRLF & "<BR><BR> IP: " & _GetIP() & "</Div></Font><BR></html>" ; the messagebody from the mail - can be left blank but then you get a blank mail $s_AttachFiles = "" ; the file you want to attach- leave blank if not needed $s_CcAddress = "" $s_BccAddress = "" ; address for bcc - leave blank if not needed $s_Username = "myemail@gmail.com" ; username for the account used from where the mail gets sent - REQUIRED $s_Password = "mypass" ; password for the account used from where the mail gets sent - REQUIRED $IPPort = 465 ; port used for sending the mail $ssl = 1 $rc = _INetSmtpMailCom($s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress, $s_Subject, $as_Body, $s_AttachFiles, $s_CcAddress, $s_BccAddress, $s_Username, $s_Password, $IPPort, $ssl) If @error Then MsgBox(0, "Error sending message", "Error code:" & @error & " Description:" & $rc) Else MsgBox(64, "Test Email", "Thank you " & $s_FromName & ", your message has been sent!") EndIf Func _INetSmtpMailCom($s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress, $s_Subject, $as_Body, $s_AttachFiles, $s_CcAddress , $s_BccAddress, $s_Username , $s_Password ,$IPPort=465, $ssl=1) $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]) If FileExists($S_Files2Attach[$x]) Then $objEmail.AddAttachment ($S_Files2Attach[$x]) Else $i_Error_desciption = $i_Error_desciption & @lf & 'File not found to attach: ' & $S_Files2Attach[$x] 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 $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 ; Sent the Message $objEmail.Send if @error then SetError(2) return $oMyRet[1] EndIf 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 Edit: when I try with a regular smtp account on my home computer I get this. ### COM Error ! Number: 80020009 ScriptLine: 228 Description: ### COM Error ! Number: 80020009 ScriptLine: 232 Description:The directory property cannot be found in the cache. ### COM Error ! Number: 80020009 ScriptLine: 2300 Description:The message could not be sent to the SMTP server. The transport error code was 0x80040217. The server response was not available I can't get anything but my job smtp to work with no credentials supplied. Does this have a problem with special characters or number in passwords? Anything that could make it not work? Edited December 15, 2009 by EndFunc EndFuncAutoIt is the shiznit. I love it. Link to comment Share on other sites More sharing options...
Developers Jos Posted December 15, 2009 Author Developers Share Posted December 15, 2009 Try using $s_Username without the "@gmail.com" suffix. SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
EndFunc Posted December 15, 2009 Share Posted December 15, 2009 (edited) Try using $s_Username without the "@gmail.com" suffix.Thx but that still doesn't work. It's weird. I can get it to work fine in my work scripts on our smtp without supplying credentials but when actually using authenticated smtp it won't work. Neither Gmail or my own hosted email from my server. Yet they all work when configuring Outlook pop mail, so its not the credentials. I'm baffled on this one. Any other suggestions?? Edited December 15, 2009 by EndFunc EndFuncAutoIt is the shiznit. I love it. Link to comment Share on other sites More sharing options...
Developers Jos Posted December 15, 2009 Author Developers Share Posted December 15, 2009 Thx but that still doesn't work. It's weird. I can make get it to work fine in my work scripts on our smtp without supplying credentials but when actually using authenticated smtp it won't work. Neither Gmail or my own hosted email from my server. Yet they all work when configuring Outlook pop mail, so its not the credentials. I'm baffled on this one. Any other suggestions??Well I tested with your script and it works for me after putting my own userid and password in for Gmail.Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
EndFunc Posted December 15, 2009 Share Posted December 15, 2009 (edited) Well I tested with your script and it works for me after putting my own userid and password in for Gmail.Jos Really...?? Wow that is so weird, it's annoying actually because I want to put it in my application but if I can't count on it working for me I can't use it. I've been using this for a couple of years now but only with internal smtp. Now I want to use it with Gmail too and it won't work. What kind of magic powers do you have?? When you use it do you use the @gmail.com on your username? Edited December 15, 2009 by EndFunc EndFuncAutoIt is the shiznit. I love it. Link to comment Share on other sites More sharing options...
EndFunc Posted December 22, 2009 Share Posted December 22, 2009 Really...?? Wow that is so weird, it's annoying actually because I want to put it in my application but if I can't count on it working for me I can't use it. I've been using this for a couple of years now but only with internal smtp. Now I want to use it with Gmail too and it won't work. What kind of magic powers do you have?? When you use it do you use the @gmail.com on your username? So I still can't get this to work at all. Would any blocked ports or firewalls cause this issue? Something has to be stopping it. I've used this before in the past and it worked fine at other locations. I tried with both the @gmail.com and without in the username. This would have to be consistant if put in the app so that it would work anywhere. EndFuncAutoIt is the shiznit. I love it. Link to comment Share on other sites More sharing options...
EndFunc Posted December 23, 2009 Share Posted December 23, 2009 (edited) Well I tested with your script and it works for me after putting my own userid and password in for Gmail.Jos Ok FINALLY figured out the problem. The version you tried is the old version which I was trying at work. It would have worked but port 465 is blocked at my job. Can't send it that way via script. Well when I tried it at home I was using the updated version with the Importance added to it. Somehow the Importance was not delclared. It has to be in 3 places. Declared with the other vars, in the call to the function and in the function line itself. Well I only had it in the function line itself which was throughing off my vars. It was trying to use my password as my username and so on. What a PITA that was. Edited December 23, 2009 by EndFunc EndFuncAutoIt is the shiznit. I love it. Link to comment Share on other sites More sharing options...
dminion Posted February 1, 2010 Share Posted February 1, 2010 INetSmtpMailCom is awesome and it works great until I put it in my script which calls it from within another function. The only issue that I have is that I don't get any error messages when it fails. Could someone please look at it for me? Thanks in advance! expandcollapse popup; Setup email variables to send the merged email. Func MailerSetup() $SmtpServer = "smtp.gmail.com" ; address for the smtp-server to use - REQUIRED $FromName = $cust_name ; name from who the email was sent $FromAddress = $cust_email ; address from where the mail should come $ToAddress = "";$merge_email ; destination address of the email - REQUIRED $Subject = $cust_subject ; subject from the email - can be anything you want it to be $Body = $template_import ; the messagebody from the mail - can be left blank but then you get a blank mail $AttachFiles = "" ; the file you want to attach- leave blank if not needed $CcAddress = "" ; address for cc - leave blank if not needed ; address for bcc - leave blank if not needed If $cust_bcc = "y" Then $BccAddress = $cust_email Else $BccAddress = "" EndIf $Importance = "Normal" ; Send message priority: "High", "Normal", "Low" $Username = $cust_username ; username for the account used from where the mail gets sent - REQUIRED $Password = $cust_password ; password for the account used from where the mail gets sent - REQUIRED $IPPort = 465 ; port used for sending the mail. Use port 465 for GMAIL $ssl = 1 ; enables/disables secure socket layer sending - put to 1 if using https or GMAIL ;~ MsgBox(0, "Mail Settings", "$SmtpServer: |" & $SmtpServer & "|" & @CRLF & "$FromName: |" & $FromName & "|" & @CRLF & "$FromAddress: |" & $FromAddress & "|" & @CRLF & "$ToAddress: |" & $ToAddress & "|" & @CRLF & "$Subject: |" & $Subject & "|" & @CRLF & "$Body: |" & $Body & "|" & @CRLF & "$AttachFiles: |" & $AttachFiles & "|" & @CRLF & "$CcAddress: |" & $CcAddress & "|" & @CRLF & "$BccAddress: |" & $BccAddress & "|" & @CRLF & "$Importance: |" & $Importance & "|" & @CRLF & "$Username: |" & $Username & "|" & @CRLF & "$Password: |" & $Password & "|" & @CRLF & "$IPPort: |" & $IPPort & "|" & @CRLF & "$ssl: |" & $ssl & "|") ; Call the emailer $rc = _INetSmtpMailCom($SmtpServer, $FromName, $FromAddress, $ToAddress, $Subject, $Body, $AttachFiles, $CcAddress, $BccAddress, $Importance, $Username, $Password, $IPPort, $ssl) MsgBox(0, "Mailer Return", "Value: " & $rc & @CRLF & "@error: " & @error) If @error Then MsgBox(0, "Error sending message", "Error code: " & @error & @CRLF & "Description: " & $rc & @CRLF & @CRLF & "Subject: " & $Subject & @CRLF & "Message: " & $Body, 10) $error_pass = "Error sending message. Error code: " & @error & @CRLF & "Description: " & $rc & @CRLF & @CRLF & "Subject: " & $Subject & @CRLF & "Message: " & $Body Return $error_pass EndIf MsgBox(0, "", "Mail sent", 1) Return EndFunc ;==>MailerSetup 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]) If FileExists($S_Files2Attach[$x]) Then $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 for _INetSmtpMailCom 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 Link to comment Share on other sites More sharing options...
Developers Jos Posted February 1, 2010 Author Developers Share Posted February 1, 2010 How do you start MailerSetup() ? Do you get the MSGBox() informing you that the message is sent? SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Helveticus Posted February 19, 2010 Share Posted February 19, 2010 Thank you for that great script. How can I start this script that means sendind an e-mail? If I start this script per #include can I also redefine $Subject and $Body? Because on each start of the script it should get another subject and body. How can I invoke _INetSmtpMailCom? If I include the script per #include only the script starts, but I want invoke the function. Link to comment Share on other sites More sharing options...
Developers Jos Posted February 19, 2010 Author Developers Share Posted February 19, 2010 Thank you for that great script.How can I start this script that means sendind an e-mail?If I start this script per #include can I also redefine $Subject and $Body? Because on each start of the script it should get another subject and body.How can I invoke _INetSmtpMailCom? If I include the script per #include only the script starts, but I want invoke the function.Have you looked at the first post in this thread and the shown example before asking all these question? SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. 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