Saved Bookmarks
| 1. |
Solve : email batch file? |
|
Answer» Hi all, I need a BATCH file that would pick my designated html file from a directory and send as an email to an email address thanks in advanceNot sure you can do this in batch without a 3rd party program. Windows Script however offers a solution: Code: [Select]Set CDO = CreateObject("CDO.Message") CDO.From = "youremailaddress" CDO.To = "receipientaddress" CDO.Subject = "text" CDO.Textbody = "moretext" CDO.AddAttachment "attachedfilename" CDO.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2 CDO.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "youremailservername" CDO.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25 CDO.Configuration.Fields.Update CDO.Send From, To, Subject, TextBody parameters should be self EVIDENT, change as needed. AddAttachment should be the path of the file you want to attach to the email. Change the SMTP server name to your ISP outgoing mail server name. Do NOT change any other parameters. After saving the script with a vbs extension, you can run it as cscript scriptname.vbs The script can also be launched from a batch file 8-) From your PM's I got the information that you're using XP.To do it with a batchscript you need a 3rd party tool for mailing. Blat is a good one. Just google for the downloadlink. hope it helps ulithank you sidewinder ..your code worked for me..i saved it as vbscript file and ran it ..mails were created and deleivered..but i also have another TASK..i need to use this file to be called in the dos batch file ..is that possible??? Just add the command cscript path\scriptname.vbs into your batch file just like any other command. If necessary add path information so Windows can find your script. 8-)Quote from: Sidewinder on December 06, 2006, 09:32:29 AM Code: [Select]Set CDO = CreateObject("CDO.Message") So, if my email was [emailprotected] then I would put that as CDO.From, and "youremailservername" would be thisisnotreal.com??? Edit, tried what I assumed...lagged then brought an error...Quote from: Helpmeh on January 21, 2009, 02:18:15 PM Quote from: Sidewinder on December 06, 2006, 09:32:29 AMCode: [Select]Set CDO = CreateObject("CDO.Message") Check with your ISP or visit their web site, but I doubt thisisnotreal.com is the name of their SMTP mail server. A reminder: never ASSUMEUmm...Why would my ISP know what the SMTP of rocketmail.com is??? If anyone knows, please tell.Quote from: Helpmeh on January 21, 2009, 04:03:40 PM Umm...Why would my ISP know what the SMTP of rocketmail.com is??? They wouldn't. Well they might, but CDO is designed to send mail through a SMTP server. I doubt any web based mail site (Hotmail, Yahoo, Microsoft Live) will allow direct access to their SMTP servers. I chose CDO as a solution to the OP to show that there are tools on most systems that many people overlook. Why did you choose to resurrect a two year old post where the OP is no longer a member? I didn't even notice how old this thread was. I just found a link in a recent thread on the same subject(Which btw you put). |
|