View Single Post
 
Old 07-16-2015, 02:11 AM
johnc83 johnc83 is offline Windows 7 64bit Office 2003
Novice
 
Join Date: Jul 2015
Posts: 6
johnc83 is on a distinguished road
Default VBScript - outlook does not recognize one or more recipients

Hi all, here is the relevant code from my .vbs file. I'm using the recipients.add code to add multiple addresses at once (I know I could add them separately on each line but would really like just the one line if possible).

Anyway, the email is created but fails to send because Outlook 2003 can't resolve the names. If I press 'Check Names' button then it says it doesn't recognise the address (it thinks ALL the addresses are one single address). However, if I put a space in front of the first email address then 'Check Names', it resolves them all instantly. Obviously because this is an automated system I can't put this space in and then check names. Would anyone be able to help me out please? Thanks, John

Code:
Dim objOutl
Set objOutl = CreateObject("Outlook.Application")
Set objMailItem = objOutl.CreateItem(olMailItem)
'comment the next line if you do not want to see the outlook window
objMailItem.Recipients.Add ("john.smith@company.com; dave.jones@company.com; mike.smith@company.com")
objMailItem.Display
objMailItem.Subject = "Daily Report"
objMailItem.Send
Set objMailItem = nothing
Reply With Quote