Solved

Email thru dos batch file with attachment... please help...

Posted on 2004-09-16
5
2,468 Views
Last Modified: 2012-05-05
good day to all,

could someone hellp me regarding my problem. Because everyday im sending an email to my boss email address using yahoo and attaching a file config.txt generated by our POS server for everday report. what i want to do is...

1. emal my boss using dos batch file....
2. attached the config.txt to the email....
   note:config.txt located at the sub-directory \control
3. should be no ms dos box arround when running(annoying)...
4. should work on any windows platform.... (for future use)...

please help me with this problem of mine. it will help me less my stress at work. not minding email at my boss everyday...

i will add a point on whom help me best.

sorry for my english. thank you..
0
Comment
Question by:dezmay
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
5 Comments
 
LVL 19

Accepted Solution

by:
RanjeetRain earned 63 total points
ID: 12080743
0
 
LVL 3

Expert Comment

by:domj
ID: 12080808
Is there a reason why you need to use a batch file? A very simple VBScript will do the job for you.

Dom
0
 
LVL 3

Assisted Solution

by:domj
domj earned 62 total points
ID: 12080827
Paste this into a text file and change the extension to .vbs (After replacing the {values} with correct values). This will require no third party downloads.

'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Set fso=CreateObject("Scripting.FileSystemObject")

strSMTP="{EnterYourSMTPServer}"
strSubject="{EnterSubject}"
strSubject="{EnterRecipient}"
strSubject="{EnterSenderAddress}"
strBody="{EnterBodyText}"
strAttach="{EnterAttachmentPath}"

If fso.FileExists(strAttach) then
Set iMsg = CreateObject("CDO.Message")
Set iConf = CreateObject("CDO.Configuration")
iConf.Load -1    ' CDO Source Defaults
Set Flds = iConf.Fields
With Flds
    .Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
    .Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = strSMTP
    .Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
    .Update
End With
With iMsg
    Set .Configuration = iConf
    .To = strRecipient
    .CC = ""
    .BCC = ""
    .From = "<" & strSender & ">"
    .Subject = strSubject
    .TextBody = strBody
    .AddAttachment strAttach
    .Send
End With
Set iMsg = Nothing
Set iConf = Nothing
Else
MsgBox "The specified attachment does not exist"
End if
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Dom
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Although it can be difficult to imagine, someday your child will have a career of his or her own. He or she will likely start a family, buy a home and start having their own children. So, while being a kid is still extremely important, it’s also …
The SignAloud Glove is capable of translating American Sign Language signs into text and audio.
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…

615 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question