• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 578
  • Last Modified:

Mass Mail Sending - Christmas Cards

Hi,

I currently use Exchange 2003 server along with Outlook 2003 Std.

We want at my company to send christmas cards to our clients and my managers decided I would have to perform the send instead of paying 50 bucks to get a company to send it out.

I am now then looking at how to send between 500-5000 emails automatically (not personnalized text, only with personalized TO: addresses, instead of using BCC ...)

Is there a free solution to use ?

Thanks
0
matanguay
Asked:
matanguay
  • 7
  • 7
1 Solution
 
David LeeCommented:
If the addresses are already in a contacts folder or, better yet, in a distribution list, or multiple distribution lists, then it'd be simple enough to write a script that handle the sending for you.
0
 
matanguayAuthor Commented:
BlueDevilFan,

Telling me to write a script does not help much ... I know I could have wrote a VBA script to handle that, but I am not that familiar with VBA for Outlook. I work more in the VBA for word, excel and access.

Outlook has a complete set of objects like word and excel and I am not familiar with this.
0
 
David LeeCommented:
I didn't tell you to write a script.  I said writing a script would be simple enough.  I'll be glad to write the script, but there's little point in my doing so up front without knowing if the addresses are in a contact list or some other place where they're readily accessible.  If you'll provide some details about where the addresses are, how the message is to be sent, things like that, then I'll put a script together for you.
0
Prepare for your VMware VCP6-DCV exam.

Josh Coen and Jason Langer have prepared the latest edition of VCP study guide. Both authors have been working in the IT field for more than a decade, and both hold VMware certifications. This 163-page guide covers all 10 of the exam blueprint sections.

 
matanguayAuthor Commented:
So sorry about that !!! my bad :(

Let's say its in a contact list as a distribution list. How would we handle that ?
and if I have a txt file with only emails (one email per line) or a csv .. same thing . ... would that be hard to handle ??

It might happen to be either.

And the body of the email must be a special body with text, images and everything ... this is for a christmas card.

THANKS !! :)
0
 
David LeeCommented:
That's okay.  

If the addresses are in a contact list or distribution list, I'd need to know which, then I can write a script that'll read the addresses out and send a seperate message to each one.  I can do the addresses from a text file too, or even a combination of ways.  Is the message body going to be html?  I'm assuming so, but it could be RTF.  I'd need to know which.  Either way, if the message body is in a file, then I can read that file in to create the message body.  Will it be the same body for each card, or a separate body for each?  If the former, then this is very easy.  If the latter, then it's a bit more difficult.  We need some way of matching each card with each recipient.  The easiest way to do that would be to have a text file as you described with one email per line, using either csv or tsv format, and have the email address followed by the file name and path to the card body, one recipient per line.  The text file approach is actually much simpler from a scripting point of view.  If we went with a distribution list or contacts, then we'd have to have a way to tie the card body to each entry.  
0
 
matanguayAuthor Commented:
If it is a distribution list, I would call it DistListMass1, and if it is a file, it would be a txt file called DistListTxt1

The body would be in HTML with images

The body will be the same for each.

0
 
matanguayAuthor Commented:
Still waiting for a script ... do you think it will be long to make ??

Thanks !
0
 
David LeeCommented:
Hi, matanguay.

Sorry, I was busy with other things yesterday.  Here's the first script.  This one reads the addresses from a text file.  I tested it in my environment (Exchange 2000, Outlook 2003) and it works properly.  Due to Outlook's built-in security features you are going to be prompted as each card is sent to allow the send.  There's no way around this when using the Outlook object model.  I've heard about third-party programs that'll click the Ok button for you, but I've never used one and cannot vouch for how well they work.  If the security dialog is a problem, then we'd have to forget about using Outlook and use an SMTP control instead.  I can point you to the SMTP control I typically use, and can provide the code to use it, but you'd have to verify that using SMTP is an option.  Some organizations won't allow the use of SMTP in applications.

I don't know if you have experience sending HTML format emails, so I'm passing this along in case you don't.  HTML emails DO NOT embed the graphics in the email itself.  Instead the graphics use an absolute path, instead of a relative path, and must be placed in a location that every recipient can get to.  In other words, an HTML email works just like a web page.  The graphics in a web page aren't embeded either.  I'm explaining this because if the graphics aren't in an accessible location, then the recipients will see a red X in place of each graphic.

I'll whip up the code for the distribution list as quick as I can, within 24 hours.

To use the code below do the following:

1.  Copy the code below and paste it into Notepad.
2.  Save the file with a .vbs extension.
3.  Edit the file as per the comments I included in it.
4.  To run the file double-click on it in Windows Explorer or open a command prompt and type the command
     Cscript Filename.vbs  (Where Filename is the name you gave the file in step #2)


Dim olApp, olNS, olMsg, objFSO, objTS, strBody
Set objFSO = CreateObject("Scripting.FileSystemObject")
'Change the path and filename on the next line to that of your HTML card
Set objTS = objFSO.OpenTextFile("C:\Testing\TheCard.htm")
strBody = objTS.ReadAll
objTS.Close
'Change the path and filename on the next line of code to that of your distribution list text file.
'Remember, one address per line and nothing else on the line.
Set objTS = objFSO.OpenTextFile("C:\Testing\DistListTxt1.txt")
Set olApp = CreateObject("Outlook.Application")
Set olNS = olApp.GetNamespace("MAPI")
'Change Outlook on the line below to the name of your Outlook profile.
olNS.Logon "Outlook"
While Not objTS.AtEndOfStream
    Set olMsg = olApp.CreateItem(olMailItem)
    With olMsg
        .BodyFormat = 2
        .HTMLBody = strBody
        'Change the subject to whatever you want.
        .Subject = "Christmas Card"
        .To = objTS.ReadLine
        .Send
    End With
Wend
objTS.Close
Set objTS = Nothing
Set objFSO = Nothing
olNS.Logoff
Set olMsg = Nothing
Set olNS = Nothing
Set olApp = Nothing            
0
 
David LeeCommented:
Here's the second script.  It is essentially the same as the first script except it gets its address information from a distribution list instead of from a text file.  It too will prompt you to allow access to the address book entries and to send each message.  I tested the portion of the code that reads the addresses and it works properly.  I did not test the script as a whole.

Dim olApp, olNS, olAddrBook, olDistList, olListEntry, olMsg, objFSO, objTS, strBody
Set objFSO = CreateObject("Scripting.FileSystemObject")
'Change the path and filename on the next line to that of your HTML card
Set objTS = objFSO.OpenTextFile("C:\Testing\TheCard.htm")
strBody = objTS.ReadAll
objTS.Close
Set objTS = Nothing
Set objFSO = Nothing
Set olApp = CreateObject("Outlook.Application")
Set olNS = olApp.GetNamespace("MAPI")
'Change Outlook on the line below to the name of your Outlook profile.
olNS.Logon "Outlook"
'Change Global Address List on the next line to the container holding the list you'll be using.
Set olAddrBook = olApp.Session.AddressLists("Global Address List")
'Change the name of the distribution list below to the name of your list
Set olDistList = olAddrBook.AddressEntries("XMAS List")
For Each olListEntry In olDistList.Members
    Set olMsg = olApp.CreateItem(olMailItem)
    With olMsg
        .BodyFormat = 2
        .HTMLBody = strBody
        'Change the subject to whatever you want.
        .Subject = "Christmas Card"
        .To = olListEntry.Name
        .Send
    End With
Next
olNS.Logoff
Set olMsg = Nothing
Set olListEntry = Nothing
Set olDistList = Nothing
Set olAddrBook = Nothing
Set olNS = Nothing
Set olApp = Nothing
0
 
matanguayAuthor Commented:
This is awesome.

Thanks.

I'll try it first thing tomorrow morning.
0
 
matanguayAuthor Commented:
Bluedevilfan,

When saving your file, my Symantec Av Corporate detected your script as a bloodhound vbs virus and deleted it. I had to disable the AV and rerun it again.

Is that normal ???
0
 
David LeeCommented:
It likely depends on the Bloodhound level.  I use Symantec also but have the Bloodhound setting set to Default and it doesn't detect it.  I'm not sure what would happen if I turned it up to the highest setting.  Since it's a file that ends with .vbs it's possible that Symantec sees it as a possible threat.  Also, since the script is designed to send messages, it's possible that Symantec sees the messages coming from a script file and takes that as the sign of a virus.  When I tested the script I only sent two messages each time, not the number you'd be sending so I really don't have a fair comparison to make.
0
 
matanguayAuthor Commented:
it fixed it.

now it is telling me that it cannot find the global address book.

since my outlook is french, it is : CARNET D'ADRESSES OUTLOOK.

I plug that in and it does not work ....

thanks
0
 
David LeeCommented:
Sorry it doesn't work.  I don't speak French and don't have access to a French version of Outlook so there's no way for me to test this further.  The script as provided does work properly with my Exchange setup so I have to believe that it's something to do with the name of the global address list.  But I can't be certain.  Does the first script, the one that works off the text file, work?  If so, then that's further evidence that it's likely the name of the GAL that's the problem.
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 7
  • 7
Tackle projects and never again get stuck behind a technical roadblock.
Join Now