pcc
Well-known Member
- Joined
- Jan 21, 2003
- Messages
- 1,382
- Office Version
- 2021
- Platform
- Windows
Code:
Sub sendmail()
'
With CreateObject("CDO.message")
With .Configuration.Fields
.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "smtp-mail.outlook.com"
.Item("http://schemas.microsoft.com/cdo/configuration/smptserverport") = 1
.Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1
.Item("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = True
.Item("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 60
.Item("http://schemas.microsoft.com/cdo/configuration/sendusername") = "Fred@hotmail.co.uk"
.Item("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "FredPassword"
.Update
End With
.To = "SomeoneElse@anotherdomain.co.uk"
.From = "Fred@hotmail.co.uk"
.Subject = "Test email"
.TextBody = "Some text to go into the body of the email"
.Send
End With
End Sub
This code sends an email OK but I would like to know how (if it's possible) to automatically delete the email after sending.
Can anyone help.
I'm using Excel 2002 at the moment!
Thanks