Jump to content


 


Register a free account to unlock additional features at BleepingComputer.com
Welcome to BleepingComputer, a free community where people like yourself come together to discuss and learn how to use their computers. Using the site is easy and fun. As a guest, you can browse and view the various discussions in the forums, but can not create a new topic or reply to an existing one unless you are logged in. Other benefits of registering an account are subscribing to topics and forums, creating a blog, and having no ads shown anywhere on the site.


Click here to Register a free account now! or read our Welcome Guide to learn how to use this site.

Photo

Send Automated E-Mail through .cmd file?


  • Please log in to reply
4 replies to this topic

#1 RiPPeN

RiPPeN

  • Members
  • 38 posts
  • OFFLINE
  •  
  • Local time:10:12 AM

Posted 31 July 2012 - 04:17 PM

Hello,

I'm doing this on a Windows XP machine. I know this is a strange question but here is what I need and the reason why I need it.

What I need to do: Send a completely automated email through a .cmd file.

Why I need to do it:
I have an automated macro that I have running on my work computer to put together a csv (txt formatted) file.
I then have this .cmd file execute this command: ftp -s:"C:\AutoUpload.txt"

What I want to know is, if there's a way that I can (without installing 3rd party software) send myself an email confirming that the file has been successfully uploaded.

Thanks in advance,
Dan

BC AdBot (Login to Remove)

 


#2 The_Outkast

The_Outkast

  • Members
  • 161 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:Ft. Wayne, IN
  • Local time:10:12 AM

Posted 31 July 2012 - 11:01 PM

You could create a VB Script and call it. The only downside is that it contains your email password in the script. I have used the following script to send email to myself. Copy the following script into a text file, modify the red items with your info, then save it as a .vbs file.

Const fromEmail = "Sender Email Address"
Const password = "Email Password"
Const toEmail = "Recipient Email Address"
Const mailSubject = "Email Subject"
Const mailBody = "Email Body"

Dim emailObj, emailConfig
Set emailObj = CreateObject("CDO.Message")
emailObj.From = fromEmail
emailObj.To = toEmail
emailObj.Subject = mailSubject
emailObj.TextBody = mailBody

Set emailConfig = emailObj.Configuration
emailConfig.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "SMTP Server name"
emailConfig.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = SMTP Port Number
emailConfig.Fields("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
emailConfig.Fields("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1
emailConfig.Fields("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = true if SSL is needed, false if it is not
emailConfig.Fields("http://schemas.microsoft.com/cdo/configuration/sendusername") = fromEmail
emailConfig.Fields("http://schemas.microsoft.com/cdo/configuration/sendpassword") = password
emailConfig.Fields.Update

emailObj.Send

#3 RiPPeN

RiPPeN
  • Topic Starter

  • Members
  • 38 posts
  • OFFLINE
  •  
  • Local time:10:12 AM

Posted 31 July 2012 - 11:24 PM

You could create a VB Script and call it. The only downside is that it contains your email password in the script. I have used the following script to send email to myself. Copy the following script into a text file, modify the red items with your info, then save it as a .vbs file.

Const fromEmail = "Sender Email Address"
Const password = "Email Password"
Const toEmail = "Recipient Email Address"
Const mailSubject = "Email Subject"
Const mailBody = "Email Body"

Dim emailObj, emailConfig
Set emailObj = CreateObject("CDO.Message")
emailObj.From = fromEmail
emailObj.To = toEmail
emailObj.Subject = mailSubject
emailObj.TextBody = mailBody

Set emailConfig = emailObj.Configuration
emailConfig.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "SMTP Server name"
emailConfig.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = SMTP Port Number
emailConfig.Fields("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
emailConfig.Fields("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1
emailConfig.Fields("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = true if SSL is needed, false if it is not
emailConfig.Fields("http://schemas.microsoft.com/cdo/configuration/sendusername") = fromEmail
emailConfig.Fields("http://schemas.microsoft.com/cdo/configuration/sendpassword") = password
emailConfig.Fields.Update

emailObj.Send


I will give it a try tomorrow thank you very much! One last question... how do i execute that vbs file from the text file that i showed above?

#4 The_Outkast

The_Outkast

  • Members
  • 161 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:Ft. Wayne, IN
  • Local time:10:12 AM

Posted 01 August 2012 - 01:10 AM

@echo off
start c:\xxx.vbs

Obviously c:\xxx.vbs would be replaced with the location and name of your file.

#5 RiPPeN

RiPPeN
  • Topic Starter

  • Members
  • 38 posts
  • OFFLINE
  •  
  • Local time:10:12 AM

Posted 01 August 2012 - 06:23 AM

Thank you again! I will let you know what happens




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users