Script to send mail with attachment on a schedule ?

Home Forums Scripting Windows Script Host Script to send mail with attachment on a schedule ?

This topic contains 3 replies, has 4 voices, and was last updated by Avatar Hobie 9 years ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • Avatar
    Albertwt
    Member
    #150393

    Hi All,

    I’d like to know if there is any other effective and easy way to send file into certain email address on a schedule ?

    I’m thinking to create a batch script which call VBScript to invoke mailto command but somehow it is failed (perhaps due to the Outlook 2003 Service pack setting ?)

    any other option would be greatly appreciated.

    Thanks,

    AWT

    Avatar
    Dumber
    Participant
    #201341

    Re: Script to send mail with attachment on a schedule ?

    Will this help?
    http://www.paulsadowski.com/wsh/cdo.htm

    Avatar
    Hobie
    Member
    #349646

    Re: Script to send mail with attachment on a schedule ?

    I have my servers email (text message) to my phone a few times a day with status updates (Drive Space on several servers, processes / services I watch, etc).

    Simple Method: (sendemail.vbs)

    Set objEmail = CreateObject(“CDO.Message”)
    ‘ — Edit the following, the FROM must be someone who can RELAY —
    objEmail.FROM = “”
    objEmail.To = “”
    objEmail.Subject = “”
    objEmail.HTMLBody = “”
    ‘ —————————————————————————————
    objEmail.Configuration.Fields.Item(“http://schemas.microsoft.com/cdo/configuration/sendusing”) = 2
    objEmail.Configuration.Fields.Item(“http://schemas.microsoft.com/cdo/configuration/smtpserver”) = “10.10.111.99” ‘ EDIT ME — IP address of you exchange server
    objEmail.Configuration.Fields.Item(“http://schemas.microsoft.com/cdo/configuration/smtpserverport”) = 25 ‘ Port for exchange
    objEmail.Configuration.Fields.Update
    objEmail.Send
    Set objEmail = Nothing

    [/CODE]

    You are probably missing the relay functionality in exchange if you have tried this and it looks like it works but nothing happens.

    Petri has a guide for this: [URL]http://www.petri.com/preventing_exchange_2000_2003_from_relaying.htm[/URL]

    Hobie[CODE]
    Set objEmail = CreateObject(“CDO.Message”)
    ‘ — Edit the following, the FROM must be someone who can RELAY —
    objEmail.FROM = “”
    objEmail.To = “”
    objEmail.Subject = “”
    objEmail.HTMLBody = “”


    objEmail.Configuration.Fields.Item(“http://schemas.microsoft.com/cdo/configuration/sendusing”) = 2
    objEmail.Configuration.Fields.Item(“http://schemas.microsoft.com/cdo/configuration/smtpserver”) = “10.10.111.99” ‘ EDIT ME — IP address of you exchange server
    objEmail.Configuration.Fields.Item(“http://schemas.microsoft.com/cdo/configuration/smtpserverport”) = 25 ‘ Port for exchange
    objEmail.Configuration.Fields.Update
    objEmail.Send
    Set objEmail = Nothing

    [/CODE]

    You are probably missing the relay functionality in exchange if you have tried this and it looks like it works but nothing happens.

    Petri has a guide for this: http://www.petri.com/preventing_exchange_2000_2003_from_relaying.htm

    Hobie

    Rems
    Rems
    Moderator
    #227802

    Re: Script to send mail with attachment on a schedule ?

    Albertwt;213727 wrote:
    I’m thinking to create a batch script which call VBScript to invoke mailto command but somehow it is failed (perhaps due to the Outlook 2003 Service pack setting ?)

    (FYI you don’t really need a batch to launch a vbscript.)

    Can you show the vbscript you have.
    What messaging solution is the company using, how is it setup.

    – There are script that are using your Outlook profile on your computer to create mailitems. Outlook must be installed and the profile must be loaded. Besides a dependency of a present mail client is Relaying never an issue with these kind of scripts.
    – And there are scripts that can deliver email messages straight to a provided smtp server. If the SMTP server is the mail Sever of your company, you can easily send internal messages. The sender don’t have to authenticate to the server and it can have a non-existing email address. You have to configure Relaying when you like to send messages also to external addresses (out of your exchange organisation). The simple way is by adding the sender’s IP to the Allow list (Or else, you could instead create a Contact for the external e-mail address in AD, make it member of a mailenabled universal distribution group. You can then use the internal address of the group to send the message out).

    Rems

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.

Register for this Petri Webinar!

Software-Defined Unlimited Backup Storage

Tuesday, August 27, 2019 @ 1:00 pm EDT

A Scale-Out Backup storage infrastructure is a must-have technology for your backups. In this webinar, join expert Rick Vanover for a look on what real-world problems are solved by the Scale-Out Backup Repository.

Register Now

Sponsored By