Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Sub Send_Email()
- 'Open your default email profile
- Set objSession = CreateObject("mapi.session")
- objSession.Logon profileName:="Outlook" 'could be anything, open mail configuration program\mail in control panel
- 'Add a new message object to the OutBox.
- Set objMessage = objSession.Outbox.Messages.Add
- 'subject and body
- objMessage.Subject = "Hey cool cat!"
- objMessage.Text = "Cats go Meow!"
- 'Add recipient - email or username if using active directory
- Set objRecipient = objMessage.Recipients.Add
- objRecipient.Name = "Cats@Meow.purrrr.com"
- objRecipient.Type = 1
- objRecipient.Resolve
- 'Send the message.
- objMessage.Send showDialog:=False
- 'Logoff using the session object.
- objSession.Logoff
- End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement