Helveticus Posted February 19, 2010 Posted February 19, 2010 I looked at your first post, but I don't see an example.
Developers Jos Posted February 19, 2010 Author Developers Posted February 19, 2010 I looked at your first post, but I don't see an example.The shown AutoIt3 code is an example that will work when you use a valid Email account with the proper providers information.For GMail make sure you set the SSL and PORT correctly as indicated in the Code. 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.
Helveticus Posted February 19, 2010 Posted February 19, 2010 I want seperate the code into a seperate .au3 file and call the function from another .au3 file. But it don't work. What do I have to put into the seperate .au3 file and what in the calling file?
ICHAPMAN Posted March 4, 2010 Posted March 4, 2010 Hi, Has anyone used this with a compressed (ZIP) file as an attachment. I've been trying without any success. My email client (Lotus Notes) receives the email but cannot open it. Instead it shows the error "File cannot be created". I've also tried to my ISP account, and the email never arrives. However, this is ONLY when adding an ZIP file (or a ZIP file that has been renamed). If I just attach a text file (for example) then everything works fine. Thanks Iain.
ICHAPMAN Posted March 4, 2010 Posted March 4, 2010 Hi,Has anyone used this with a compressed (ZIP) file as an attachment.I've been trying without any success. My email client (Lotus Notes) receives the email but cannot open it. Instead it shows the error "File cannot be created". I've also tried to my ISP account, and the email never arrives.However, this is ONLY when adding an ZIP file (or a ZIP file that has been renamed). If I just attach a text file (for example) then everything works fine.ThanksIain.Ignore me please. I'd done something fairly silly which was causing my issues.ThanksIain
SuperFletch Posted April 20, 2010 Posted April 20, 2010 Is there a reason I can't find an helo in this UDF? How would I include one? I can get it to work through gmail but not a local smtp provider that seems to require helo. Awesome UDF by the way. TIA,
SuperFletch Posted April 21, 2010 Posted April 21, 2010 I think I've answered this now, but correct me if I'm wrong. Seeing this UDF makes sure I authenticate with username and password I have been able to log in to an upstream smtp server without needing helo. I'm guessing this is how it is meant to work?? If I'm wrong please tell me as I'd love to know. Anyhow - I've now got a working script now that sends mail (effectively) via my local smtp server without helo. Once again - great UDF
Developers Jos Posted April 22, 2010 Author Developers Posted April 22, 2010 It is a UDF that is using the standard Microsoft CDO com object. So any specific info about the capabilities can be found on the Microsoft site. 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.
SuperFletch Posted April 22, 2010 Posted April 22, 2010 It is a UDF that is using the standard Microsoft CDO com object. So any specific info about the capabilities can be found on the Microsoft site.JosThank you.
BinaryBrother Posted May 3, 2010 Posted May 3, 2010 (edited) I reviewed this thread twice and almost missed the 1 post explaining how to do multiple attachments. Which was luck, because the post had nothing to do with multiple attachments, it was just a usage example on one of the later pages. So I figured I would throw this out there for the searchers. In order to send more than one attachment, the $attachment line should look like this...$AttachFiles = $File1 & ";" & $File2 & ";" & $File3 or$AttachFiles = "C:\test1.jpg;C:\test2.jpg;C:\test3.jpg"Simply separate the attachments with ; Edited May 3, 2010 by BinaryBrother SIGNATURE_0X800007D NOT FOUND
z3r0c00l12 Posted May 12, 2010 Posted May 12, 2010 (edited) Works Great for me after a few hours of testing with Gmail, wasn't working and I was getting the error : Error Code:2 Description: The transport failed to connect to the server. Tried lots of things and finally got it working on my own. (I read this whole topic, but none of the solutions were working) So here's how I got it working, might sound silly, but worked for me... I saved the UDF section (including the Com handler to it's own au3 file. Then created a dummy file in which I put : #include "smtp.au3" ;################################## ; Variables ;################################## $SmtpServer = "smtp.gmail.com" ; address for the smtp-server to use - REQUIRED $FromName = "Name" ; name from who the email was sent $FromAddress = "name@gmail.com" ; address from where the mail should come $ToAddress = "name@gmail.com" ; destination address of the email - REQUIRED $Subject = "Test2" ; subject from the email - can be anything you want it to be $Body = "TEXT2 <b>BOLD</b>" ; the messagebody from the mail - can be left blank but then you get a blank mail $Importance = "Normal" ; Send message priority: "High", "Normal", "Low" $Username = "name" ; username for the account used from where the mail gets sent - REQUIRED $Password = "password" ; password for the account used from where the mail gets sent - REQUIRED $IPPort = 465 ; port used for sending the mail $ssl = 1 ; enables/disables secure socket layer sending - put to 1 if using httpS Notice I removed the AttachFiles,CcAddress and BccAddress. <EDIT> Also notice that for authentication, Gmail accepts both "name" and "name@gmail.com". for people asking (maybe add this to the first post), the FromName will show up when you send an e-mail, but this is just the name, if you look at the header of the e-mail correctly, you'll see something like "Name LastName <Name.LastName@gmail.com>". your e-mail client decides which one it shows you... </EDIT> Then when calling the function, I simply replaced the 3 variables with empty quotes like this : _INetSmtpMailCom($SmtpServer, $FromName, $FromAddress, $ToAddress, $Subject, $Body, "", "", "", $Importance, $Username, $Password, $IPPort, $ssl) Has since worked great, I don't know why, I tried putting the variables back after and it still worked fine, I'm guessing there was some type of hidden character playing against me within one of those variables, so if you have any problem, at least give it a try. z3r0c00l12 Edited May 12, 2010 by z3r0c00l12
z3r0c00l12 Posted May 13, 2010 Posted May 13, 2010 (edited) Little touch up required in the Attach files part of the udf,Can you add support for full path as the attach file variable, so that if I input "C:\script\output.txt" it doesnt give an error an stop the script, instead, have the script check if the path is full, if it is, send as is, if the path is relative, then use the _PathFull function.Here is what I did to solve my problem, maybe you could use that, or optimize it :if Stringmid($S_Files2Attach[$x],2, 1) = ":" then Else $S_Files2Attach[$x] = _PathFull($S_Files2Attach[$x]) EndIfAlso, I noticed while looking at the debug output that the file attach debug will show this (for each file sent): @@ Debug(62) : $S_Files2Attach = >Error code: 0Looking at the code I found that the consolewrite was not using the array properly, this is why no filename is shown in the debug output.ConsoleWrite('@@ Debug(62) : $S_Files2Attach = ' & $S_Files2Attach & @LF & '>Error code: ' & @error & @LF) ;### Debug Consoleshould be changed to : ConsoleWrite('@@ Debug(62) : $S_Files2Attach = ' & $S_Files2Attach[$x] & @LF & '>Error code: ' & @error & @LF) ;### Debug ConsoleThank you,z3r0c00l12 Edited May 13, 2010 by z3r0c00l12
Developers Jos Posted May 13, 2010 Author Developers Posted May 13, 2010 I do not understand what the issue is when the fullpath is already defined as that should be supported too by _PathFull(). What is exactly going wrong for you? I fixed the debug line which actually shouldn't have been there any more and was a leftover from some testing. 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.
z3r0c00l12 Posted May 13, 2010 Posted May 13, 2010 I was getting an error from the pathfull function when giving it a full path, I don't know what I did, but it's working normally now, using a full path. since I can't reproduce the error anymore and I'm using your script the way it was initially, I'll say it was a mistake on my part somewhere. I removed the debug line, like you said. My next step is trying to get my Cisco routers and switches to send syslogs (receive them with autoit), then have autoit send me the logs by email every day. Thanks again for a great script. z3r0c00l12
Helveticus Posted May 22, 2010 Posted May 22, 2010 What is the return value of the function _INetSmtpMailCom? @error=1 if an error occurs and @error=0 if there is no error?
TheReveller Posted May 22, 2010 Posted May 22, 2010 What's the use of $s_FromAddress ? When I send an e-mail, it will say the $Username as the "from address" And I can't make it work for Hotmail, only works with Gmail
Developers Jos Posted May 22, 2010 Author Developers Posted May 22, 2010 What is the return value of the function _INetSmtpMailCom? @error=1 if an error occurs and @error=0 if there is no error?Look at the bottom of the example in the first post. The @error is set to 2 and the return vealu to the Description of the error from the CommError func, 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.
Developers Jos Posted May 22, 2010 Author Developers Posted May 22, 2010 (edited) What's the use of $s_FromAddress ? the Email address you send the Email for?And I can't make it work for Hotmail, only works with GmailThis needs an SMTP Server either secure or Open. Believe Hotmail only has this available for paid accounts.Jos Edited May 22, 2010 by 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.
PlatinumHex Posted May 24, 2010 Posted May 24, 2010 Hey guys!I'm not good at searching topics and posts.When I tried to add an attachment using the script, I get this....+> File attachment added: C:\Users\Gavin\Documents\AutoItImage.jpgF:\AutoIt\ResearchDATA\SMTP_JOS\RC001.au3 (259) : ==> Object referenced outside a "With" statement.:.AddAttachment($S_Files2Attach[$x])^ ERROR->16:31:09 AutoIT3.exe ended.rc:1Any ideas?Regards,
Developers Jos Posted May 24, 2010 Author Developers Posted May 24, 2010 Not enough info. Post your script that you are testing with and remove your personal Email account info. 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.
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