I was tasked with creating a script for a user to send logs for an app via email with attachments on a schedualed basis. Of course you can not schedule Outlook to to send mail. You could use mapisend.exe which is a command line utility that ships with MS BackOffice Resource Kit. You can use it to create a batch but you have to have mapi installed on the server or pc that you are sending the email from. Blat is also used to send email through the command line. I do not have any experience with Blat. Here is a link to send an email through vbs that I have been using for scripting and schedualing for years.
Set objMessage = CreateObject("CDO.Message")
objMessage.Subject = "hdl test"
objMessage.From = "username@domain.org"
objMessage.To = "username@domain.org"
objMessage.To = "username@domain.org"
objMessage.To = "username@domain.org"
objMessage.TextBody = ""
objMessage.Addattachment "%systemdrive%\temp\Test.txt"
'==This section provides the configuration information for the remote SMTP server.
'==Normally you will only change the server name or IP.
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
'Name or IP of Remote SMTP Server
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "smtp server ip address"
'Server port (typically 25)
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
objMessage.Configuration.Fields.Update
'==End remote SMTP server configuration section==
objMessage.Send
Here is a script that I have used to troubleshoot reporting issues from the reporting application to the SMTP server.
Here is a good link to test troubleshoot sending mail uing telnet. I have always experienced that many venders will want you to do send email from telnet to ensure that there are not issues with your smtp server.
Set objMessage = CreateObject("CDO.Message")
objMessage.Subject = "hdl test"
objMessage.From = "username@domain.org"
objMessage.To = "username@domain.org"
objMessage.To = "username@domain.org"
objMessage.To = "username@domain.org"
objMessage.TextBody = ""
objMessage.Addattachment "%systemdrive%\temp\Test.txt"
'==This section provides the configuration information for the remote SMTP server.
'==Normally you will only change the server name or IP.
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
'Name or IP of Remote SMTP Server
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "smtp server ip address"
'Server port (typically 25)
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
objMessage.Configuration.Fields.Update
'==End remote SMTP server configuration section==
objMessage.Send
Here is a script that I have used to troubleshoot reporting issues from the reporting application to the SMTP server.
Here is a good link to test troubleshoot sending mail uing telnet. I have always experienced that many venders will want you to do send email from telnet to ensure that there are not issues with your smtp server.
No comments:
Post a Comment