A1VBCode Forums

Messages sent by a VB6 application return undelivered if email client is Outlook 2003


http://www.a1vbcode.com/vbforums/Topic17782.aspx

By Condulmari - 3/22/2006

In my vb6 application I use two controls:

a MAPISession control named "POSTA"

a MAPIMessages control named "INVIAPREV"

the following is the code used to send a message with an attachment. (sorry for variable names and control names in italian)

----------------------

POSTA.SignOn

With INVIAPREV

.SessionID = POSTA.SessionID

.Compose

.RecipDisplayName = "TUO SERVIZI PER IL LEASING"

.RecipAddress = "tuo@analisifinanziaria.it"

.MsgSubject = "Invio Preventivo Leasing n." & Me.CERCA

.AttachmentPathName = App.Path & stDBF

.MsgNoteText = "Invio Preventivo"

.Send True

End With

POSTA.SignOff

MsgBox "Invio eseguito", vbInformation, "E-MAIL"

------------------------

The attachment is a text file

The application has been in use for over 2 years and the code works perfectly if the default email client is Outlook Express or Outlook 2000.

When the default email client is Outlook 2003 the message returns undelivered.

The message is displayed before is sent.

Normally, right clicking the recipient address of a message about to be sent the context menu contains the item "Outlook Properties"

in the case of the message generated by my application, instead, the context menu contains an item "Properties" instead of the standard "Outlook Properties"

the properties displayed by a normal message ("Outlook Properties") are the following

_________________

Displayed name: TUO SERVIZI PER IL LEASING

Email: tuo@analisifinanziaria.it

Email Type: SMTP

Internet Type: "Send in RTF Outlook format"

------------------------

In the case of the message displayed by my application the properties are

------------------------

Displayed name: TUO SERVIZI PER IL LEASING

Email: tuo@analisifinanziaria.it

Email Type: TUO@ANALISIFINANZIARIA.IT

Internet Type: "Send in RTF Outlook format"

-------------------------

If the message is sent as it is it will return undelivered.

I can manually correct the email type by clicking the button "internet type" and changing the type in "SMTP" after which the message is regularly dispatched.

I have no idea on how to make the same correction programmatically.

It is very important for me to solve this problem.