how to spam an email using VBS - email

So i would like to spam an email to check the spam filters. However, it keeps giving me error messages. Such as
could not connect to STMP server
Please help me to improve this.
Dim User
Dim Pass
Dim Name
Dim Input
Dim Input2
Dim Input3
X=MsgBox("Welcome. To log in Please Click OK and enter your G-mail & pass.",0,"EmailSpamBot V1.0")
User = InputBox("Enter your G-mail:")
Pass = InputBox("Enter Password:"& vbCrLf & ""& vbCrLf & "Please note passwords are NOT stored in this script and are case sensitive.")
Name = InputBox("Enter Name:")
Input = InputBox("Enter e-mail of victim:")
Input2 = InputBox("Enter title:")
Input3 = InputBox("Enter message:")
EmailSubject = (""& Input2)
EmailBody = (""& Input3)
'Const EmailFrom = ""
'Const EmailFromName = ""
Const SMTPServer = "smtp.gmail.com"
'Const SMTPLogon = ""
'Const SMTPPassword = ""
Const SMTPSSL = True
Const SMTPPort = 465
Const cdoSendUsingPickup = 1 'Send message using local SMTP service pickup directory.
Const cdoSendUsingPort = 2 'Send the message using SMTP over TCP/IP networking.
Const cdoAnonymous = 0 ' No authentication
Const cdoBasic = 1 ' BASIC clear text authentication
Const cdoNTLM = 2 ' NTLM, Microsoft proprietary authentication
' First, create the message
Set objMessage = CreateObject("CDO.Message")
objMessage.Subject = EmailSubject
objMessage.From = "<" & User & Name & ">"
objMessage.To = "<" & Input & ">"
objMessage.TextBody = EmailBody
' Second, configure the server
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserver") = SMTPServer
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = cdoBasic
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/sendusername") = User
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/sendpassword") = Pass
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = SMTPPort
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = SMTPSSL
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 60
objMessage.Configuration.Fields.Update
do
ObjMessage.Send
loop
Any help would be greatly appreciatied

The error message "could not connect to SMTP server" means that your script couldn't establish a connection to the given port on the remote host. That usually happens when a firewall is blocking access. You can verify that with the telnet command:
telnet smtp.gmail.com 465
If access is blocked you should be getting output like this after the timeout expiered:
Connecting To smtp.gmail.com...Could not open connection to the host, on port 465: Connect failed
A tool like tracetcp might provide further insight as to where the packets are blocked.
However, sending authenticated mail is normally for outbound message submission. If you want to test your own spam filter, you should be sending inbound mail (to port 25).

I figured out the problem, when you enter your email, five minutes or so later you get a security email about a less secure app attempting to access, that is the VBS script, you click on the enable less secure app access, and then it works.

Related

Send multiple messages in ASP

After an internal form is submitted, I want an email to go to the form-filler with specific information and then a new email sent to the customer with different information. As of right now, with what I have, I can make the first email go, but how do I reset the mailer and do it all over again on the same page?
I can make it work if I double-up the code below, but the AddAddress list doesn't reset. The recipients added in the first iteration will still be on the AddAddress list for the second iteration.
This is what I have so far:
message= "<html><body><table><tr><td>Blah blah blah</td></tr>"
message=message & "<tr><td>Something something.</td></tr>"
message=message & "</table></body></html>"
Set Mail = Server.CreateObject("Persits.MailSender")
Mail.Host = "domain-com.mail.protection.outlook.com"
Mail.From = "website#domain.com"
Mail.FromName = "person#domain.com"
Mail.AddAddress "me#domain.com"
Mail.Subject = "Gast Repair. Enter P21 order for: " & request.form("CompanyName")
Mail.Body = message
Mail.IsHTML = True
strErr = ""
bSuccess = False
On Error Resume Next ' catch errors
Mail.Send ' send message
If Err <> 0 Then ' error occurred
strErr = Err.Description
'response.write "<P>" & strErr & "</P>"
else
bSuccess = True
'response.redirect sendto
End If
Thanks for the help!
Why use Persits?
Set ObjSendMail = CreateObject("CDO.Message")
ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2 'Send the message using the network (SMTP over the network).
ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserver") = strOutgoingMailServer
ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1
ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusername") = strSmtp-auth
ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendpassword") = strSmtp-pass
ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = False 'Use SSL for the connection (True or False)
ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 60
ObjSendMail.Configuration.Fields.Update
ObjSendMail.To = "Somebody <somebody#example.com>"
ObjSendMail.Subject = strSubject
ObjSendMail.From = strFromName & " <no-reply#example.com>"
ObjSendMail.ReplyTo = strFromName & " <" & strFromEmail & ">"
ObjSendMail.BodyPart.Charset = "UTF-8"
ObjSendMail.TextBody = strEmailBody
ObjSendMail.TextBodyPart.Charset = "UTF-8"
On Error Resume Next
ObjSendMail.Send
Set ObjSendMail = Nothing
Then write a new strEmailBody (message) and run this code again for the new recipient.
If you have problems sending via SMTP server on Windows server, try installing the free hmailServer software.
The official documentation for the Persits.MailSender COM component provides a few methods;
Reset()
Clears all address, attachment and custom header lists so that a new message can be sent.
ResetAddress()
Clears all address lists so that a new message can be sent. Does not clear attachments, embedded images, custom headers or properties.
There is also
ResetAll()
Same as Reset plus resets all properties to their respective default values.
Note: This will completely reset the Mail object back to its default values.
I would give these a try.

Using CDO/SMTP/TLS in VB6 to send email smtp.office365.com mail server

I am searching for days to find out how can I set Office365 SMTP server in my VB6 application. My code is working properly with port 465 and other mail servers.
BUT it is not working with port 587 and smtp.office365.com
Is there any way I could have TLS via 587 in VB6?
Thanks
With this code, I get to send mail using CDO to Office365.
Private Message As CDO.Message
Private Attachment, Expression, Matches, FilenameMatch, i
Sub enviar_mail()
Set Message = New CDO.Message
Message.Subject = "Test Mail"
Message.From = "YourEmail#yourdomain.com"
Message.To = ""
Message.CC = ""
Message.TextBody = "my text body here"
Dim Configuration
Set Configuration = CreateObject("CDO.Configuration")
Configuration.Load -1 ' CDO Source Defaults
Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "smtp.office365.com"
Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1
Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusername") = "YourEmail#yourdomain.com"
Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "YourPass"
Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = True
Configuration.Fields.Update
Set Message.Configuration = Configuration
Message.Send
End Sub
This code worked for me until a few days ago when we switched ISP's (or maybe something changed coincidentally on the server side). If I specify port 587, I get a transport error and have not found the solution for that with VBA. Please let me know if this works for you and if you find a way to use 587. (Port 25 doesn't work for me either, same error.)
Public Function SMTPSend(vSendTo, vsubject As Variant, vmessage As Variant)
'This works
Set emailObj = CreateObject("CDO.Message")
emailObj.From = "name#myemail.com"
emailObj.To = vSendTo
emailObj.Subject = vsubject
emailObj.TextBody = vmessage
'emailObj.AddAttachment "c:\windows\win.ini"
Set emailConfig = emailObj.configuration
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/smtpserver") = "smtp.office365.com"
'Must exclude port if specifying SSL
'emailConfig.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 587
emailConfig.Fields("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = True
emailConfig.Fields("http://schemas.microsoft.com/cdo/configuration/sendusername") = "name#myemail.com"
emailConfig.Fields("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "mypassword"
emailConfig.Fields.Update
emailObj.Send
If Err.Number = 0 Then SMTPSend = True Else SMTPSend = False
End Function
There seem to be a number of posts on various forums suggesting that the CDO library doesn't work with port 587, but that's not true. I think the real issue is that SMTP services using port 587 are doing so because they require STARTTLS authentication and the http://schemas.microsoft.com/cdo/configuration/smtpusessl config option is specific to SSL, not TLS (I know, I know - not the most accurate description but it'll suffice for now).
Instead, there is another setting - http://schemas.microsoft.com/cdo/configuration/sendtls - that does support TLS, so using this with port 587 works fine:
config.Fields("http://schemas.microsoft.com/cdo/configuration/sendusing").Value = 2 '2 = cdoSendUsingPort
config.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserver").Value = "smtp.example.com"
config.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserverport").Value = 587
config.Fields("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate").Value = 1 '1 = cdoBasic
config.Fields("http://schemas.microsoft.com/cdo/configuration/sendusername").Value = "my_username"
config.Fields("http://schemas.microsoft.com/cdo/configuration/sendpassword").Value = "myy_very_secret_password"
config.Fields("http://schemas.microsoft.com/cdo/configuration/sendtls").Value = True
config.Fields("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout").Value = 60
config.Fields.Update()
This is what worked for me:
flds("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
flds("http://schemas.microsoft.com/cdo/configuration/smtpserver")= "smtp.office365.com"
flds("http://schemas.microsoft.com/cdo/configuration/smtpserverport")= 25
flds("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate")= 1
flds("http://schemas.microsoft.com/cdo/configuration/sendusername")= "name#myemail.com"
flds("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "mypasword"
flds("http://schemas.microsoft.com/cdo/configuration/smtpusessl")= True
flds("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout")= 60
I don't know if you could fix it, but I got it with this:
Private Sub Command1_Click()
Dim oSmtp As New EASendMailObjLib.Mail
oSmtp.LicenseCode = "TryIt"
' Set your Hotmail email address
oSmtp.FromAddr = "liveid#hotmail.com"
' Add recipient email address
oSmtp.AddRecipientEx "support#emailarchitect.net", 0
' Set email subject
oSmtp.Subject = "test email from hotmail account"
' Set email body
oSmtp.BodyText = "this is a test email sent from VB 6.0 project with hotmail"
' Hotmail SMTP server address
oSmtp.ServerAddr = "smtp.live.com"
' Hotmail user authentication should use your
' Hotmail email address as the user name.
oSmtp.UserName = "liveid#hotmail.com"
oSmtp.Password = "yourpassword"
' Set port to 25, if you want to use 587 port, please change 25 to 587
oSmtp.ServerPort = 25
' detect SSL/TLS connection automatically
oSmtp.SSL_init
MsgBox "start to send email ..."
If oSmtp.SendMail() = 0 Then
MsgBox "email was sent successfully!"
Else
MsgBox "failed to send email with the following error:" & oSmtp.GetLastErrDescription()
End If
End Sub
Font: https://www.emailarchitect.net/easendmail/kb/vb.aspx?cat=4
Remember download the library:
http://easendmail-smtp-component-net-edition.soft112.com/
Just Replace Parameters!

VBScript that sends an email without an SMTP server?

I'm trying to create a VBS script that sends an alert email when a folder has reached a specific file size, but I can't seem to get it to send an email. I get this error - "The transport failed to connect to the server". Is there any way to send an email without a SMTP server or?
I changed my pswrd/email an stuff for obv reasons.
Const dirPath = "C:\Users\tim.mcgee\Desktop\Offsite Drive"
Const alertedPath = "prevRun.txt"
alertOn = 3 * 2 ^ 29 '1.5GB
resetOn = alertOn * .95 'Approx 77MB
Const emailTo = "**"
Const emailFrom = "**"
Const emailSbjct = "Offsite Drive Full"
Const emailMsg = "The offsite drive has reached maximum capacity."
Const SMTPServer = "Smtp.gmail.com"
Const SMTPPort = 25
emailUsr = emailFrom
Const emailPsswd = "**"
Const emailSSL = False
Set fso = CreateObject("Scripting.FileSystemObject")
If fso.FileExists(alertedPath) Then
alerted = CBool(Trim(fso.OpenTextFile(alertedPath).ReadLine))
Else
alerted = False
End If
dirSize = fso.GetFolder(dirPath).Size
If alerted Then 'Email previously sent
alerted = dirSize > resetOn
ElseIf dirSize >= alertOn Then
SendEmail
alerted = True
End If
fso.OpenTextFile(alertedPath, 2, True).WriteLine CInt(alerted)
WScript.Quit 0
Sub SendEmail
Const cfg = "http://schemas.microsoft.com/cdo/configuration/"
With CreateObject("CDO.Message")
.From = emailFrom
.To = emailTo
.Subject = emailSbjct
.TextBody = emailMsg
With .Configuration.Fields
.Item(cfg & "sendusing") = 2
.Item(cfg & "smtpserver") = SMTPServer
.Item(cfg & "smtpserverport") = SMTPPort
.Item(cfg & "smtpconnectiontimeout") = 60
.Item(cfg & "smtpauthenticate") = 1
.Item(cfg & "smtpusessl") = emailSSL
.Item(cfg & "sendusername") = emailUsr
.Item(cfg & "sendpassword") = emailPsswd
.Update
End With
.Send
End With
End Sub
The error message means that your script can't connect to smtp.gmail.com on port 25. Nowadays most ISPs don't allow outbound mail on port 25 as a spam prevention measure. You need to send either through one of their mail relays, or the remote server must accept mail on a different port, usually 587 (submission) or 465 (SMTPS, deprecated).
Since you already have credentials you should probably just change the value of SMTPPort to 587 or 465. Gmail should accept authenticated mail on either of those ports.
As for your question about sending mail without an SMTP server, when using CDO you basically have 3 options for sending messages. You select the one you want to use via the sendusing configuration field:
cdoSendUsingPickup (numeric value 1): allows you to send mail without having to specify an SMTP server, but you must have an SMTP server installed on the host where the script is running. With this method the mail is submitted to the local SMTP server via a pickup folder. Does not require authentication, but the SMTP server must be configured to route mail correctly.
Normally, when you have a setup with local SMTP servers, these are configured to send all picked up mail to a central mail gateway/hub, which handles further delivery.
cdoSendUsingPort (numeric value 2, default): allows you to send mail to any SMTP server via the SMTP protocol. Also allows you to provide explicit credentials. With this method you must specify an SMTP server to send the mail to.
cdoSendUsingExchange (numeric value 3): allows you to send mail through the Exchange server of your domain. Requires a domain and an Exchange server, obviously.

Send email vbscript asp

I have Windows Server 2012 R2 and IIS8.5
I trying to send email via CDo
<%
Const cdoSendUsingPickup = 1 'Send message using the local SMTP service pickup directory.
Const cdoSendUsingPort = 2 'Send the message using the network (SMTP over the network).
Const cdoAnonymous = 0 'Do not authenticate
Const cdoBasic = 1 'basic (clear-text) authentication
Const cdoNTLM = 2 'NTLM
Set objMessage = CreateObject("CDO.Message")
objMessage.Subject = "Example CDO Message"
objMessage.From = "mymail#gmail.com"
objMessage.To = "email#gmail.com"
objMessage.TextBody = "This is some sample message text.." & vbCRLF & "It was sent using SMTP authentication."
'==This section provides the configuration information for the remote SMTP server.
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
'Name or IP of Remote SMTP Server
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "smtp.gmail.com"
'Type of authentication, NONE, Basic (Base64 encoded), NTLM
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = cdoBasic
'Your UserID on the SMTP server
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/sendusername") = "myemail#gmail.com"
'Your password on the SMTP server
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "mypass"
'Server port (typically 25)
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
'Use SSL for the connection (False or True)
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = False
'Connection Timeout in seconds (the maximum time CDO will try to establish a connection to the SMTP server)
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 60
objMessage.Configuration.Fields.Update
'==End remote SMTP server configuration section==
objMessage.Send
response.write objMessage.Err.number
%>
Response goes more than 84000 ms and I get error
Active Server Pages error 'ASP 0113'
Script timed out
/login.asp
The maximum amount of time for a script to execute was exceeded. You can change this limit by specifying a new value for the property Server.ScriptTimeout or by changing the value in the IIS administration tools.
Sending the same email with same code from VBA is OK without any error.
What is wrong?
At the top of page you have to recall libreries:
<!--METADATA TYPE="typelib" UUID="CD000000-8B95-11D1-82DB-00C04FB1625D" NAME="CDO for Windows 2000 Type Library" -->
<!--METADATA TYPE="typelib" UUID="00000205-0000-0010-8000-00AA006D2EA4" NAME="ADODB Type Library" -->
<%#LANGUAGE="VBSCRIPT"%>
Then you can try to use this code:
Set email_info = CreateObject("CDO.Message")
Set iConf = CreateObject("CDO.Configuration")
Set Flds = iConf.Fields
Flds(cdoSendUsingMethod) = cdoSendUsingPort
Flds(cdoSMTPServer) = "smtp.domain-name.ext"
Flds(cdoSMTPServerPort) = 25
Flds(cdoSMTPAuthenticate) = cdoAnonymous ' 0
Flds.Update
Set email_info.Configuration = iConf

Couldn't send message to SMTP server. Transport Error 0x80040217

I get this error when sending a mail through asp using gmail, I already used ports 465, 587 and 25 with same results
Dim mail
dim email2 as string
dim urlms as string
Dim mail
dim email2 as string
dim urlms as string
mail = CreateObject("CDO.Message")
urlms = "http://schemas.microsoft.com/cdo/configuration/"
mail.Configuration.Fields.Item(urlms & "sendusing") = 2 'enviar usando port
mail.Configuration.Fields.Item(urlms & "smtpserver") = "smtp.gmail.com"
mail.Configuration.Fields.Item(urlms & "smtpserverport") = 465
mail.Configuration.Fields.Item(urlms & "smtpusessl") = True
mail.Configuration.Fields.Item(urlms & "smtpconnectiontimeout") = 60
mail.Configuration.Fields.Item(urlms + "smtpauthenticate") = 1
mail.Configuration.Fields.Item(urlms + "sendusername") = "" 'login
mail.Configuration.Fields.Item(urlms + "sendpassword") = "" 'password
mail.Configuration.Fields.Update
mail.Send
If you are using 2-Step authentication in Google Account then you need to change settings either opt to "Enable Less Secure Apps" or generate app passwords that will be 16 chars and you need to use this in your code instead of your actual gmail password.
https://www.google.com/settings/security/lesssecureapps
It worked like a charm for my own mail server, but It fails with Gmail I don't know why....
Anyway, I tried also without the plus to concatinate and didnt work either, finally I used this:
Dim ObjSendMail
Set ObjSendMail = CreateObject("CDO.Message")
'This section provides the configuration information for the remote SMTP server.
ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2 'Send the message using the network (SMTP over the network).
ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserver") ="mail.yoursite.com"
ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 465 ' or 587
ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = True
ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 60
' Google apps mail servers require outgoing authentication. Use a valid email address and password registered with Google Apps.
ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1 'basic (clear-text) authentication
ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusername") ="somemail#yourserver.com" 'your Google apps mailbox address
ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendpassword") ="yourpassword" 'Google apps password for that mailbox
ObjSendMail.Configuration.Fields.Update
ObjSendMail.To = "someone#someone.net"
ObjSendMail.Subject = "this is the subject"
ObjSendMail.From = "someone#someone.net"
' we are sending a text email.. simply switch the comments around to send an html email instead
'ObjSendMail.HTMLBody = "this is the body"
ObjSendMail.TextBody = "this is the body"
ObjSendMail.Send
Set ObjSendMail = Nothing
http://somee.com/DOKA/DoHelpTopics.aspx?docode=false&thnid=102
And worked like a charm for my server but it didn't work for gmail.
//
// MessageId: CDO_E_LOGON_FAILURE
//
// MessageText:
//
// The transport was unable to log on to the server.
//
#define CDO_E_LOGON_FAILURE 0x80040217L
Also why are you using plus to concatinate the three config items.
Your code Dims everything twice. And it dims things as strings.
You are creating objects without using Set.
I doubt your code runs to generate an error.
Note: The message says LOGON ERROR. Make sure name and password is correct.
Set emailObj = CreateObject("CDO.Message")
emailObj.From = "dc#gail.com"
emailObj.To = "dc#gail.com"
emailObj.Subject = "Test CDO"
emailObj.TextBody = "Test CDO"
Set emailConfig = emailObj.Configuration
msgbox emailConfig.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserver")
emailConfig.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "smtp.gmail.com"
emailConfig.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 465
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
emailConfig.Fields("http://schemas.microsoft.com/cdo/configuration/sendusername") = "YourUserName"
emailConfig.Fields("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "Password1"
emailConfig.Fields.Update
emailObj.Send
If err.number = 0 then Msgbox "Done"