1. Computer problem? Tech Support Guy is completely free -- paid for by advertisers and donations. Click here to join today! If you're new to Tech Support Guy, we highly recommend that you visit our Guide for New Members.

Outlook - Send Outlook email via command line w/attached file

Discussion in 'Business Applications' started by Tamizpa, Apr 18, 2008.

Thread Status:
Not open for further replies.
Advertisement
  1. Tamizpa

    Tamizpa Thread Starter

    Joined:
    Jun 5, 2007
    Messages:
    30
    I would like to know if I could send an outlook email via command line while also attaching a file via command line. I am trying to have a Windows 2000 or 2003 server inititiate an email when it sees a certain text file arrive on the server. The email should run automatically with the file attached. I've found this attached link on how to do the command line: http://support.microsoft.com/kb/192341/en-us But no mention of attaching a file. Anyone have any ideas? Thanks!
     
  2. Rollin_Again

    Rollin_Again

    Joined:
    Sep 4, 2003
    Messages:
    4,912
    I would use Windows built in TASK SCHEDULER to fire a VBS script to check for the file and if found automatically email it.

    There are multiple ways to accomplish this using the Outlook Object Model, MAPI Mail, or CDO mail. I'll try to post some examples in a bit.


    Regards,
    Rollin
     
  3. Rollin_Again

    Rollin_Again

    Joined:
    Sep 4, 2003
    Messages:
    4,912
    Is this file going to be automatically saved or exported to a certain directory on the server or will the file be emailed to the server machine? We also need to know what type of naming convention will be used for this file. Will the file always be named the same and saved to the same location? Will the directory where the file will be saved to contain any other files? Will you be deleting or moving the file once it has been processed?

    More details please.

    Regards,
    Rollin
     
  4. Tamizpa

    Tamizpa Thread Starter

    Joined:
    Jun 5, 2007
    Messages:
    30
    Thanks for your quick response. It will have the same name each time. It will be a .txt file. (Don't have the exact name yet.) The file will be coming from the mainframe to the server. We want the file to be attached to the email, then have it deleted off the server once emailed. It should be the only file in the directory. Let me know if that's enough detail. I can make calls to find out more if needed.
     
  5. Rollin_Again

    Rollin_Again

    Joined:
    Sep 4, 2003
    Messages:
    4,912
    I need details about your email configuration. Is there a mail client installed on the server or will the mail be sent directly through your SMTP server?

    Regards,
    Rollin
     
  6. dmgaddy

    dmgaddy

    Joined:
    Apr 8, 2008
    Messages:
    28
    There are any number of command line mailers that can do what you are asking. Bmail or Blat for example.

    HTH
     
  7. Tamizpa

    Tamizpa Thread Starter

    Joined:
    Jun 5, 2007
    Messages:
    30
    We're planning on the customer putting a email client on the server. I was able to get more detail. Below's a synopsis of what we were thinking of doing. We're currently managing our customer's network with CA Concord's eHealth and they want Concord to do this alerting function for them --

    Mainframe FTP’s File to Windows 2000 Server
    Concord monitors Server for file and sends alerts upon seeing it.
    In the alerting function, Concord can execute VBS script to run Outlook (via command line), email file to distribution list, then delete file.

    After talking to my co-worker's here, they know how to monitor the server for the file, we just don't know about how to do VBS/Outlook command line or if it was doable. Our customer is using Outlook, so we don't want to use Blat or something else cause we won't be managing the actual server or email account...they will since it's their server. We're just trying to see if this scenario is doable. Thanks for all your help.
     
  8. Rollin_Again

    Rollin_Again

    Joined:
    Sep 4, 2003
    Messages:
    4,912
    All you need is the SMTP server address and port number and you can send the email automatically using CDO without having to install an email client. If you get that info I'll help you with the code. If you decide to use Outlook to send the email you will run into issues with the built in security prompt that is generated. There are workarounds but I find it easiest to just send the mail directly through the SMTP server unless you need to keep the sent mail items for historical purposes.

    Regards,
    Rollin
     
  9. Sponsor

As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 733,556 other people just like you!

Loading...
Thread Status:
Not open for further replies.

Short URL to this thread: https://techguy.org/704910

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice