471,326 Members | 2,607 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,326 software developers and data experts.

Outlook Problem

I have been using "mapi" to send mail from my vb applications for
some time. I am now working in vb.net. The problem I am having now is
that I need the "from" address to be different than the default one
for the user.

I could not find a way to change the "from" address when sending a
mail. Another way that would work would be to change to a different
email account or change the default account to something different. I
could find a way to do that either.

I finally solve it by setting by a second profile and logging on as the
alternate profile. This solution turned out to be unacceptable to the
user. For one thing she had to be completely log out of her normal
profile or it would work. Below is the code I use so you can see what
I'm doing.

Dim mobjOutlook As New Outlook.Application

Dim moItems As Outlook.Items

Dim moCt As Outlook.ContactItem
' Dim oCt As Outlook.DistListItem

Dim mobjmail As Outlook.MailItem
Dim mMyAttachments As Object

Dim oNS As Outlook.NameSpace = mobjOutlook.GetNamespace("mapi")
oNS.Logon(mProfilename, "", False, True) '
mobjmail = mobjOutlook.CreateItem(0)
' Send the mail
With mobjmail
.Subject = pSubject
.Body = pBody
.To = pTo
.CC = pcc
.BCC = pBcc

End With

Jul 21 '05 #1
0 1096

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Fritz Switzer | last post: by
9 posts views Thread by John | last post: by
10 posts views Thread by John | last post: by
4 posts views Thread by damian | last post: by
8 posts views Thread by Li Pang | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.