* Want to send mail using Windows Scripting Object
* Using VB Script
Step - Step :
1. First, Install the software : "easendmail.exe"
2. Try to copy the below script and save the file name with "SendEmail_01.vbs"
'----------------------------------------------------------------------------------
'----------------------------------------------------------------------------------
Sub Send( From, Recipient, Subject, Body, Server )
NORMAL_RECIPIENT = 0
COPY_RECIPIENT = 1
BLIND_COPY_RECIPIENT = 2
TEXT_PLAIN = 0
TEXT_HTML = 1
Dim oSmtp
Set oSmtp = CreateObject("EASendMailObj.Mail")
'The license code for EASendMail ActiveX Object,
'for evaluation usage, please use "TryIt" as the license code.
oSmtp.LicenseCode = "TryIt"
oSmtp.Reset
oSmtp.FromAddr = From
oSmtp.Subject = Subject
oSmtp.BodyFormat = TEXT_PLAIN
oSmtp.BodyText = Body
oSmtp.ServerAddr = Server
oSmtp.AddRecipient Recipient, Recipient, NORMAL_RECIPIENT
oSmtp.UserName = "name01"
oSmtp.Password = "pass01"
oSmtp.AddAttachment "C:\Work\AutoRestoreDB_Output.txt"
' | add cc recipient
' | oSmtp.AddRecipient "test", "test@domain.com", COPY_RECIPIENT
' | add bcc recipient
' | oSmtp.AddRecipient "test", "test@domain.com", BLIND_COPY_RECIPIENT
' | ESMTP authentication
' | oSmtp.UserName = "your user name"
' | oSmtp.Password = "your password"
If oSmtp.SendMail() = 0 Then
'WScript.Echo "Sending email to " & Recipient & " succeeded!"
Else
'WScript.Echo oSmtp.GetLastErrDescription()
End If
End Sub
'WScript.Echo "Please edit this file and input sender, recipient, subject, body and smtp server"
'Send "fromEmail@domain.co.id", "toEmail@domain.co.id", "test subject", "test body", "127.0.0.1"
Send "fromEmail@domain.co.id", "toEmail@domain.co.id", "Is Restore Database TESTING is OK ?", "Please check the attachments file", "mail.domain.co.id"
'----------------------------------------------------------------------------------
'----------------------------------------------------------------------------------
3. Then try to run the script ( with double-click the file )
4. Next, could check the inbox Messages
Sumber :
http://www.emailarchitect.net/easendmail/