Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

IN A HURRY! Outlook Macro: Mass mail

Status
Not open for further replies.

curium248

Programmer
Feb 5, 2002
1
US
I am trying to make a macro to mail (individualy) to a list of people in my contacts folder in Outlook. I dont want it to be a mass list of people on the "to:" of my letter. I tryed the "rule wizard" to no avail. I want code to send a message I have already created to a person in a folder, then progress one by one down the list untill they have all been mailed to (individually!) This seems like it's easy right...just do a mail merge...but my email is HTML and when I do the mail merge it works...but only sends the text...not the HTML... if someone knows the macro in VB that'd be awesome, because there is no record function. THANK YOU! I really need help fast...
 
Hey man.
um, I'm not familiar with doing macros at all, so I'm not sure if this is gonna help you or not. But I do have a way of coding a method that sends emails like you described above. So, I'm just gonna copy some of the code I have down here:

If (Not lstrTo = vbNullString) Then
'<start outlook application>
Set lobjOutlook = CreateObject(&quot;Outlook.application&quot;)
'<create new mail item (0)>
Set lobjMail = lobjOutlook.createitem(0)
Let lobjMail.subject = lstrSubject
Let lobjMail.HTMLBody = lstrBody '<add body>

'Let lobjMail.SentOnBehalfOfName = lstrFrom

Let lobjMail.to = lstrTo '<apply To list>

'Let objMail.cc = lstrCc '<apply CC list>
'Let lobjMail.bcc = lstrBCC '<apply bcc list>

'<add attachments>
Set lobjAttachment = lobjMail.attachments
lobjAttachment.Add path1, , , <Description of the file>
lobjAttachment.Add path2, , , <Description of the file>
......

'lobjMail.display

lobjMail.send
lobjOutlook.Quit

End If

Like I said, I don't know if this is applicable in your situation at all. But if you can't find a way to do it, maybe you can use this code and code your way around it, or maybe this code can give you some suggestions on how to make it happen.
Hope this helps a little bit. Sorry for making you read all this if it doesn't. :)
good luck!!! --- Merlin
 
Try:

Sub ContactMassMail()
Dim oNS As Outlook.NameSpace
Dim oContacts As Outlook.MAPIFolder
Dim oContact As Outlook.ContactItem
Dim oDrafts As Outlook.MAPIFolder
Dim oMailTemplate As Outlook.MailItem
Dim oMailOut As Outlook.MailItem

Set oNS = Application.GetNamespace(&quot;MAPI&quot;)
Set oDrafts = oNS.GetDefaultFolder(olFolderDrafts)
Set oContacts = oNS.GetDefaultFolder(olFolderContacts)

For Each oMailTemplate In oDrafts.Items
For Each oContact In oContacts.Items
If oContact.Email1Address <> &quot;&quot; Then
Set oMailOut = oMailTemplate.Copy
oMailOut.To = oContact.Email1Address
oMailOut.Send
End If
Next oContact
Next
End Sub Jon Hawkins
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top