Sending mail via outlook

April 19, 2011 at 22:52:50
Specs: Windows XP, 2GB
Thanks in advance....

I want to create a batch file suppose to send email to two different people with attachment of daily created new text files.. i am using microsoft outlook exchange server.

Help will be really appreciated.

See More: Sending mail via outlook

Report •

April 20, 2011 at 15:49:26
may be you can try this VBScript..
SMTPServer = "yourexchangeserver"
Recipient = "the receivers email add"
From = "youremail add"
Subject = "email subject"
Message = "Email subject."

'attachment = "c:\test.txt"

GenericSendmail SMTPserver, From, Recipient, Subject, Message

Sub GenericSendmail (SMTPserver, From, Recipient, Subject, Message)

set msg = WScript.CreateObject("CDO.Message")
msg.From = From
msg.To = Recipient
msg.Subject = Subject
msg.TextBody = Message
'msg.AddAttachment attachment

msg.Configuration.Fields ("") = SMTPServer
msg.Configuration.Fields("") = 2



End Sub


you can run this script from a command line or batch file, like cscript script.vbs

Subhash Chandra.

Report •

April 21, 2011 at 11:21:04
Thanks very much subhash.
i am using exchange server...will it work? kingly help.

Report •

April 21, 2011 at 12:19:26
yes, It should .

Check this article on how can you configure it.

Subhash Chandra.

Report •

Related Solutions

April 21, 2011 at 13:51:40
When running your script below error occurs.

" The server rejected the sender address. The server response was: 530 5.7.0 Must issue a STARTTLS command first."

Code: 8004020E

Report •

April 22, 2011 at 05:36:36
that's the exchange server response. can you check with exchange admin about that error ? Otherwise alternatively you can use a console app

i dont think using batch you can send email from outlook..

Subhash Chandra.

Report •

Ask Question