Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

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

Posted on 2004-09-16
5
Medium Priority
?
2,469 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 252 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 248 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

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

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

Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
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…
Simple Linear Regression

715 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