myspacee Posted June 19, 2009 Posted June 19, 2009 Hello, read on forum several send mail example. Few about send mail + attachment I want to include this feature in one of my script, but not find an UDF or simple example. (some required external resource [gmail, etc]) Post here a vbs script that done this task in simple way : expandcollapse popup'_________________________________________________________________ ' set vars '_________________________________________________________________ dim Attachment set vArgs = WScript.Arguments Attachment = "c:\tmuninst.ini" Set objFSO = CreateObject("Scripting.FileSystemObject") '_________________________________________________________________ ' set MAIL '_________________________________________________________________ Set objMessage = CreateObject("CDO.Message") objMessage.Subject = "this is Subject " & date & " " & TIME objMessage.From = "mike@autoit.it" objMessage.To = "robert@autoit.it" objMessage.TextBody = "send report" '_________________________________________________________________ ' In attachment exist send '_________________________________________________________________ If objFSO.FileExists(Attachment) Then objMessage.AddAttachment Attachment Else objMessage.Subject = date & " " & TIME & ". Report NOt exists. " End If '_________________________________________________________________ ' SERVER SMTP '_________________________________________________________________ objMessage.Configuration.Fields.Item _ ("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2 'NOME O IP SERVER CON SMTP ATTIVO objMessage.Configuration.Fields.Item _ ("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "yyy.xxx.1.36" 'PORTA DEL SERVER (SMTP ASCOLTA SULLA 25) objMessage.Configuration.Fields.Item _ ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25 objMessage.Configuration.Fields.Update '_________________________________________________________________ ' SEND '_________________________________________________________________ objMessage.Send I've an SMTP mail server on my lan so i want to use it (not want to use external resource [gmail, yahoo, etc]) Anyone can suggest me something easy to include this in a script ? Thank you for reading, m.
Juvigy Posted June 19, 2009 Posted June 19, 2009 Do you have outlook (but not exkspress)?$oOApp = ObjCreate("Outlook.Application") $oOMail = $oOApp.CreateItem($olMailItem) $oOMail.Save With $oOMail .To = (" type@here.com") .Subject = "test mail" .BodyFormat = 3 .Importance = 1 .Body = "Hi there" .attachments.add ("full file path") .Display .Send EndWith
myspacee Posted June 19, 2009 Author Posted June 19, 2009 thank you for reply, Need this feature for a script that do something on a server as scheduled script. Then it send result to different users. I can't use outlook. m.
Zedna Posted June 21, 2009 Posted June 21, 2009 Look herehttp://www.autoitscript.com/forum/index.ph...860&hl=smtp Resources UDF ResourcesEx UDF AutoIt Forum Search
myspacee Posted June 21, 2009 Author Posted June 21, 2009 thank you for reply, but understand that UDF needs external SMTP server with username password. (eg Gmail) my script must run in work intranet with no internet access, but internal mail server (that support send trought SMTP) You know if is possible use also LAN resources ? m.
water Posted June 23, 2009 Posted June 23, 2009 (edited) Or you could use an external program like blat (Blat is a Win32 command line utility that sends eMail using SMTP).No need for installation (but you can), all necessary information can be provided on the command line. Edited June 23, 2009 by water My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
myspacee Posted June 23, 2009 Author Posted June 23, 2009 Thank again for interest. At this point use my .vbs script and integrate it in AI script. m.
Juvigy Posted June 23, 2009 Posted June 23, 2009 If it is only that i think there is VBS to AUtoit converter available in the forum.Use the search.
Zedna Posted June 23, 2009 Posted June 23, 2009 thank you for reply,but understand that UDF needs external SMTP server with username password. (eg Gmail)my script must run in work intranet with no internet access, but internal mail server (that support send trought SMTP)You know if is possible use also LAN resources ?m.I think this UDF will work in this scenario. Just try it...Maybe there must be set some parametres for connection. Resources UDF ResourcesEx UDF AutoIt Forum Search
LurchMan Posted June 23, 2009 Posted June 23, 2009 I've implemented a simliar script on a couple servers where I work and if you have a mail server just use that as the smtp server and youll be able to send internal emails only, and if you want to send external emails then youll have to use username / password. Dating a girl is just like writing software. Everything's going to work just fine in the testing lab (dating), but as soon as you have contract with a customer (marriage), then your program (life) is going to be facing new situations you never expected. You'll be forced to patch the code (admit you're wrong) and then the code (wife) will just end up all bloated and unmaintainable in the end.
99ojo Posted June 23, 2009 Posted June 23, 2009 (edited) Hi, i'm using _INetSmtpMail function with an internal LotusNotes SMTP Server. You don't need user and password verifaction, if your smtp sever is configured to use it without user verification. In our case, the LoNo SMTP does only IP Filtering on SMTP Port. Depending on your SMTP server you may define $s_helo = "" and $s_first = -1 (see help file _INetSmtpMail function) Good luck ;-)) Stefan Edited June 23, 2009 by 99ojo
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