email created with VB won't send

  • Thread starter Thread starter Keith
  • Start date Start date
K

Keith

I have an application, written in VB6, that attempts to use MAPI to send an
email (BCC) to a small number (typically 30-40) recipients. Here is the code:
MAPISession.DownLoadMail = False
MAPISession.SignOn

MAPIMessages.SessionID = MAPISession.SessionID

MAPIMessages.Compose
MAPIMessages.MsgSubject = Subject
MAPIMessages.MsgType = "SMTP"
MAPIMessages.MsgNoteText = .tbIntro.Text & Paragraph & MessageText

For Each strAddress In .Addresses
MAPIMessages.RecipIndex = MAPIMessages.RecipCount
MAPIMessages.RecipType = mapBccList
MAPIMessages.RecipAddress = strAddress
MAPIMessages.RecipDisplayName = strAddress
Next strAddress
MAPIMessages.Send True
MAPISession.SignOff

On the face of it, this seems to work. The email appears in Outlook's out
box. The problem is Outlook won't send it. If I click Send/Receive in Outlook
(2003), all the other mail items get sent but the one created by my VB app
just sits there.

If I create a new email in Outlook, copy and paste the text, subject and
recipients from the "stuck" mail into the new one, the new one gets sent OK
so clearly there's nothing wrong with the recipient list itself but there's
something subtly wrong with the email I created. Have I missed something? Any
suggestions what might be wrong with my email causing Outlook to refuse to
send it?
 
That looks like CDOSys or CDOEX or some other API (not the Outlook related
CDO 1.21). There's almost no expertise in that here. My suggestion would be
to use the Outlook object model and do things right so Outlook gets a
properly formatted message.
 
Back
Top