Sending mail via outlook

April 19, 2011 at 22:52:50
Specs: Windows XP, 2GB
Hi,
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 •


#1
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 ("http://schemas.microsoft.com/cdo/configuration/smtpserver") = SMTPServer
msg.Configuration.Fields("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2

msg.Configuration.Fields.Update

msg.Send

End Sub

--------------------------------------------------------------------------

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

Subhash Chandra.


Report •

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

Report •

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

Check this article on how can you configure it.

http://www.computing.net/howtos/sho...

Subhash Chandra.


Report •

Related Solutions

#4
April 21, 2011 at 13:51:40
hi,
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 •

#5
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

http://www.muquit.com/muquit/softwa...

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

Subhash Chandra.


Report •


Ask Question