How to .Display CDO.Message before sending it ???

Status
Not open for further replies.

elnino

New Member
Joined
Feb 10, 2018
Messages
2
Hi everyone!

I am trying to connect excel to gmail via VBA. I did it and macro successfully sends the email. BUT!

I want to see and be able to edit the email with attachment if necessary! I know that you cannot display CDO.message but maybe there is a way around/past that ???

Here is my code:

Sub sendemail()


Dim mymail As CDO.message
Set mymail = New CDO.message


mymail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = True
mymail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1
mymail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "smtp.gmail.com"
mymail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
mymail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
mymail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusername") = "*******@gmail.com"
mymail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "*******"
mymail.Configuration.Fields.Update


With mymail
.Subject = "Test Email from El"
.From = "******@gmail.com"
.To = ""
.CC = ""
.BCC = ""
.TextBody = "Goor morning!"
.addAttachments "c:\...."
.Send 'do not want to send, how to display instead?
End With


On Error Resume Next


If Err.Number <> 0 Then
MsgBox Err.Description, vbCritical, "there was an error"
Exit Sub
End If
MsgBox ("mail has been sent")
Set mymail = Nothing


End Sub
 

Excel Facts

Which came first: VisiCalc or Lotus 1-2-3?
Dan Bricklin and Bob Frankston debuted VisiCalc in 1979 as a Visible Calculator. Lotus 1-2-3 debuted in the early 1980's, from Mitch Kapor.
Status
Not open for further replies.

Forum statistics

Threads
1,213,549
Messages
6,114,264
Members
448,558
Latest member
aivin

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top