Announcement

Collapse
No announcement yet.

Script to send mail with attachment on a schedule ?

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Script to send mail with attachment on a schedule ?

    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

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

    Will this help?
    http://www.paulsadowski.com/wsh/cdo.htm
    Marcel
    Technical Consultant
    Netherlands
    http://www.phetios.com
    http://blog.nessus.nl

    MCITP(EA, SA), MCSA/E 2003:Security, CCNA, SNAF, DCUCI, CCSA/E/E+ (R60), VCP4/5, NCDA, NCIE - SAN, NCIE - BR, EMCPE
    "No matter how secure, there is always the human factor."

    "Enjoy life today, tomorrow may never come."
    "If you're going through hell, keep going. ~Winston Churchill"

    Comment


    • #3
      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)

      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
      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_exch...m_relaying.htm

      Hobie

      Comment


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

        Originally posted by Albertwt View Post
        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
        Last edited by Rems; 3rd August 2010, 14:59.

        This posting is provided "AS IS" with no warranties, and confers no rights.

        __________________

        ** Remember to give credit where credit's due **
        and leave Reputation Points for meaningful posts

        Comment

        Working...
        X