Group:  Microsoft Outlook ยป microsoft.public.outlook.program_addins
Thread: Sending mail with attachment from my vb6 addin

Geek News

Sending mail with attachment from my vb6 addin
"hhandersson[ at ]gmail.com" <hhandersson[ at ]gmail.com> 4/12/2006 12:40:04 PM
Hi,

i've programmed an addin in VB6 which is sending mail from our CRM
system automatically.

The addin works fine, that means that it's doing what I want it to do.

When the addin is installed on a system with outlook 2000 (SMTP/POP3)
the attachment arrives at the recipient correct but when outlook 2003
(SMTP/POP3) is installed, the attachment is sent as winmail.dat and of
course some systems are not able to open it.

When the addin is installed on a system with outlook 2003 in
combination with Exchange 2000/2003 the attachment is correct again.

Here is an example of my code:
---------------------------------------------------------------------------------------------------------
Set olMsg = m_olApp.CreateItem(olMailItem)
olMsg.Subject = ls_Subject

olMsg.To = ls_Name + "<" + ls_Address + ">"
olMsg.Body = m_sMailBody + vbNewLine + vbNewLine

If Left(m_olApp.Version, 2) = "11" Then
olMsg.BodyFormat = 1 'PlainText
End If

olMsg.Save
olMsg.Attachments.Add ls_FileName, olByValue, Len(olMsg.Body) - 1

olMsg.Send
---------------------------------------------------------------------------------------------------------

Thanks a lot for your help and answers.

Henrik

Re: Sending mail with attachment from my vb6 addin
"Sue Mosher [MVP-Outlook]" <suemvp[ at ]outlookcode.com> 4/27/2006 7:03:20 AM
You must set BodyFormat before setting the Body property, not after. You may want to consider setting HTMLBody instead of Body so that you send an HTML format message.

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003
http://www.turtleflock.com/olconfig/index.htm
and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
http://www.outlookcode.com/jumpstart.aspx

<hhandersson[ at ]gmail.com> wrote in message news:1144845604.640192.216190[ at ]u72g2000cwu.googlegroups.com...
[Quoted Text]
> Hi,
>
> i've programmed an addin in VB6 which is sending mail from our CRM
> system automatically.
>
> The addin works fine, that means that it's doing what I want it to do.
>
> When the addin is installed on a system with outlook 2000 (SMTP/POP3)
> the attachment arrives at the recipient correct but when outlook 2003
> (SMTP/POP3) is installed, the attachment is sent as winmail.dat and of
> course some systems are not able to open it.
>
> When the addin is installed on a system with outlook 2003 in
> combination with Exchange 2000/2003 the attachment is correct again.
>
> Here is an example of my code:
> ---------------------------------------------------------------------------------------------------------
> Set olMsg = m_olApp.CreateItem(olMailItem)
> olMsg.Subject = ls_Subject
>
> olMsg.To = ls_Name + "<" + ls_Address + ">"
> olMsg.Body = m_sMailBody + vbNewLine + vbNewLine
>
> If Left(m_olApp.Version, 2) = "11" Then
> olMsg.BodyFormat = 1 'PlainText
> End If
>
> olMsg.Save
> olMsg.Attachments.Add ls_FileName, olByValue, Len(olMsg.Body) - 1
>
> olMsg.Send
> ---------------------------------------------------------------------------------------------------------
>
> Thanks a lot for your help and answers.
>
> Henrik
>

Home | Search | Terms | Imprint Contact
Newsgroups Reader - provided by WiredBox.Net