tinygreypixel Posted February 6, 2008 Posted February 6, 2008 Hi, I tried to make a script that sends email using INetSmtpMail, but as I see, this function doesn't support smtp authentication (username/password). Is there a solution?
Richard Robertson Posted February 6, 2008 Posted February 6, 2008 If you know the protocol, you could modify the UDF slightly to send any authentication information. If it works, you may as well suggest it to be applied to the distributed UDF.
tinygreypixel Posted February 6, 2008 Author Posted February 6, 2008 If you know the protocol, you could modify the UDF slightly to send any authentication information. If it works, you may as well suggest it to be applied to the distributed UDF.That's the problem, I don't know the protocol. I was hoping that someone got a working email sending function that supports smtp authentication.
Kip Posted February 6, 2008 Posted February 6, 2008 maybe Username:Password@Domain.com MailSpons: Fake SMTP server for safe email testing Dutch postcode & address API.
Legacy99 Posted February 6, 2008 Posted February 6, 2008 (edited) This might work [edit] I added authentication but have not tested it. [/edit] Func Email() $objMessage = ObjCreate("CDO.Message") $objMessage.Subject = "Your Subject" $objMessage.From = "Email From field" $objMessage.To = "Mail To" $objMessage.CC = "CC recipient" $objMessage.BCC= "BCC recipient" $objMessage.TextBody = "Email Body " ;==This section provides the configuration information for the remote SMTP server. ;==Normally you will only change the server name or IP. $objMessage.Configuration.Fields.Item _ ("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2 ;Name or IP of Remote SMTP Server $objMessage.Configuration.Fields.Item _ ("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "SMTP Server" ;Server port (typically 25) $objMessage.Configuration.Fields.Item _ ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25 ;Not Tested $objMessage.Configuration.Fields.Item _ ("http://schemas.microsoft.com/cdo/configuration/sendusername") = $smtpuser ;Not Tested $objMessage.Configuration.Fields.Item _ ("http://schemas.microsoft.com/cdo/configuration/sendpassword") = $smtppass $objMessage.Configuration.Fields.Update ;==End remote SMTP server configuration section== $objMessage.Send EndFunc Edited February 7, 2008 by Legacy99
tinygreypixel Posted February 6, 2008 Author Posted February 6, 2008 This might work [edit] I added authentication but have not tested it. [/edit] ... Thanks, I'll try it later and will be back with the result.
tinygreypixel Posted February 6, 2008 Author Posted February 6, 2008 Doesn't work. It says: $objMessage.Send $objMessage.Send^ERROR Error: The requested action with this object has failed.
Legacy99 Posted February 7, 2008 Posted February 7, 2008 I don't have the script here to test it but did you include? #include <IE.au3> #include <INet.au3> Not sure if that makes a difference And check the username and password lines I added, I noticed the underscore in "$objMessage.Configuration.Fields.Item _ " is missing a space, I will edit it
tinygreypixel Posted February 7, 2008 Author Posted February 7, 2008 I don't have the script here to test it but did you include?#include <IE.au3>#include <INet.au3>Not sure if that makes a differenceAnd check the username and password lines I added, I noticed the underscore in "$objMessage.Configuration.Fields.Item _ " is missing a space, I will edit itNo, it doesn't make any difference if I include those files. I've corrected the underscores, that was not a problem, it seems we have to use another object type, or dunno. The _INetSmtpMail function looks a little complicated, but maybe it could be modified to have smtp authentication.
Uten Posted February 7, 2008 Posted February 7, 2008 I have not tested it but I think you want this modified version of _INetSmptMail. The files are in the second post. Please keep your sig. small! Use the help file. Search the forum. Then ask unresolved questions :) Script plugin demo, Simple Trace udf, TrayMenuEx udf, IOChatter demo, freebasic multithreaded dll sample, PostMessage, Aspell, Code profiling
tinygreypixel Posted February 7, 2008 Author Posted February 7, 2008 I have not tested it but I think you want this modified version of _INetSmptMail. The files are in the second post.Works like a charm! Thank you!
Legacy99 Posted February 7, 2008 Posted February 7, 2008 I got it working with Gmail, I assume other ISP's that use a different port from 25 and require authentication will be similar you need to add: $objMessage.Configuration.Fields.Item _ ("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1 $objMessage.Configuration.Fields.Item _ ("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = true $objMessage.Configuration.Fields.Item _ ("http://schemas.microsoft.com/cdo/configuration/sendusername") = "Username@gmail.com" $objMessage.Configuration.Fields.Item _ ("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "Password" $objMessage.Configuration.Fields.Item _ ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 465oÝ÷ Ù*"¶ÈhºWe¢%G+ ¢eyªçx&j׫©Hz0jZ-Þiº.´ β·&®¶sdgVæ2VÖ¢b33c¶ö&¤ÖW76vRÒö&¤7&VFRgV÷C´4DòäÖW76vRgV÷C²¢b33c¶ö&¤ÖW76vRå7V&¦V7BÒgV÷Cµ÷W"7V&¦V7BgV÷C°¢b33c¶ö&¤ÖW76vRäg&öÒÒgV÷C´VÖÂg&öÒfVÆBgV÷C°¢b33c¶ö&¤ÖW76vRåFòÒgV÷C´ÖÂFògV÷C°¢b33c¶ö&¤ÖW76vRä42ÒgV÷C´42&V6VçBgV÷C°¢b33c¶ö&¤ÖW76vRä$43ÒgV÷C´$42&V6VçBgV÷C°¢b33c¶ö&¤ÖW76vRåFWD&öGÒgV÷C´VÖÂ&öGgV÷C° £³ÓÕF26V7Föâ&÷fFW2FR6öæfwW&Föâæf÷&ÖFöâf÷"FR&VÖ÷FR4ÕE6W'fW"ࣳÓÔæ÷&ÖÆÇ÷RvÆÂöæÇ6ævRFR6W'fW"æÖR÷"à¢b33c¶ö&¤ÖW76vRä6öæfwW&FöâäfVÆG2äFVÒð¢gV÷C¶GG¢ò÷66VÖ2æÖ7&÷6ögBæ6öÒö6Fòö6öæfwW&Föâ÷6VæGW6ærgV÷C²Ò" £´æÖR÷"öb&VÖ÷FR4ÕE6W'fW ¢b33c¶ö&¤ÖW76vRä6öæfwW&FöâäfVÆG2äFVÒð¢gV÷C¶GG¢ò÷66VÖ2æÖ7&÷6ögBæ6öÒö6Fòö6öæfwW&Föâ÷6×G6W'fW"gV÷C²ÒgV÷C¶vÖÂç6×Gæ6öÒgV÷C° ¢b33c¶ö&¤ÖW76vRä6öæfwW&FöâäfVÆG2äFVÒð¢gV÷C¶GG¢ò÷66VÖ2æÖ7&÷6ögBæ6öÒö6Fòö6öæfwW&Föâ÷6×GWFVçF6FRgV÷C²Ò ¢b33c¶ö&¤ÖW76vRä6öæfwW&FöâäfVÆG2äFVÒð¢gV÷C¶GG¢ò÷66VÖ2æÖ7&÷6ögBæ6öÒö6Fòö6öæfwW&Föâ÷6×GW6W76ÂgV÷C²ÒG'VP ¢b33c¶ö&¤ÖW76vRä6öæfwW&FöâäfVÆG2äFVÒð¢gV÷C¶GG¢ò÷66VÖ2æÖ7&÷6ögBæ6öÒö6Fòö6öæfwW&Föâ÷6VæGW6W&æÖRgV÷C²ÒgV÷CµW6W&æÖTvÖÂæ6öÒgV÷C° ¢b33c¶ö&¤ÖW76vRä6öæfwW&FöâäfVÆG2äFVÒð¢gV÷C¶GG¢ò÷66VÖ2æÖ7&÷6ögBæ6öÒö6Fòö6öæfwW&Föâ÷6VæG77v÷&BgV÷C²ÒgV÷Cµ77v÷&BgV÷C° £µ6W'fW"÷'BG6ÆÇ#R¢b33c¶ö&¤ÖW76vRä6öæfwW&FöâäfVÆG2äFVÒð¢gV÷C¶GG¢ò÷66VÖ2æÖ7&÷6ögBæ6öÒö6Fòö6öæfwW&Föâ÷6×G6W'fW'÷'BgV÷C²ÒCcP¢¢b33c¶ö&¤ÖW76vRä6öæfwW&FöâäfVÆG2åWFFP £³ÓÔVæB&VÖ÷FR4ÕE6W'fW"6öæfwW&Föâ6V7FöãÓÐ ¢b33c¶ö&¤ÖW76vRå6Væ@¤VæDgVæ0
Uten Posted February 7, 2008 Posted February 7, 2008 I think there is a bug in the file _INetSmtpMail.au3 used in the topic I linked to. Take a look at my post for changes. I also added a line:If not IsArray($as_Body) Then $as_Body = StringSplit($as_Body, @CRLF) at the top of the function _INetSmtpMail to make sure it did not malfunction by a misunderstanding. Please keep your sig. small! Use the help file. Search the forum. Then ask unresolved questions :) Script plugin demo, Simple Trace udf, TrayMenuEx udf, IOChatter demo, freebasic multithreaded dll sample, PostMessage, Aspell, Code profiling
ChrisL Posted February 7, 2008 Posted February 7, 2008 Hi,I tried to make a script that sends email using INetSmtpMail, but as I see, this function doesn't support smtp authentication (username/password). Is there a solution?Look at this by Jos http://www.autoitscript.com/forum/index.ph...c=23860&hl= it's very good! [u]Scripts[/u]Minimize gui to systray _ Fail safe source recoveryMsgbox UDF _ _procwatch() Stop your app from being closedLicensed/Trial software system _ Buffering Hotkeys_SQL.au3 ADODB.Connection _ Search 2d Arrays_SplashTextWithGraphicOn() _ Adjust Screen GammaTransparent Controls _ Eventlogs without the crap_GuiCtrlCreateFlash() _ Simple Interscript communication[u]Websites[/u]Curious Campers VW Hightops Lambert Plant Hire
Uten Posted February 8, 2008 Posted February 8, 2008 Does not work if your ISP is the bitchy kind.. Please keep your sig. small! Use the help file. Search the forum. Then ask unresolved questions :) Script plugin demo, Simple Trace udf, TrayMenuEx udf, IOChatter demo, freebasic multithreaded dll sample, PostMessage, Aspell, Code profiling
tinygreypixel Posted February 8, 2008 Author Posted February 8, 2008 I think there is a bug in the file _INetSmtpMail.au3 used in the topic I linked to. Take a look at my post for changes. I also added a line: If not IsArray($as_Body) Then $as_Body = StringSplit($as_Body, @CRLF) at the top of the function _INetSmtpMail to make sure it did not malfunction by a misunderstanding. Thanks for the correction! I think you are right. By the way, adding that line you suggested, it generates extra empty lines, as stated in the autoit help of StringSplit: "Caution if you use the macro @CRLF you are referring to a 2 character string so you will generate extra blanks lines." Look at this by Jos http://www.autoitscript.com/forum/index.ph...c=23860&hl= it's very good! Looks good too. But the one that Uten suggested is perfect for me. Thank you all for your help.
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