MAPI UserName - Profile - Sender 
Author Message
 MAPI UserName - Profile - Sender

I can successfully use MAPI to send email (MS Outlook Express verision 5),
but with one shortcoming:  I want to be able to override the Default Account
Profile.

Assume the I have 2 email accounts: Grapefruit (default) and Banana.  Both
are valid mail accounts and both work in Outlook Express.  When I send mail
via OE manually, the send mail dialog shows (by default) the Grapefruit
account in the From box, but if I want the mail to be sent from the Banana
account, I can simply select that acount from the combo box, and the
recipient receives mail from Banana.

I want to achieve the same using VB6.  The following code send mail just
fine but always uses the default account, and I can find no way to override
this.  I've tried various combinations of UserName, LogonUI, and NewSession
properties.  I've searched the Microsoft MSDN site to no avail.

HELP!!!
---------------------------------------------------
Private Sub SendMail()

    ' A Form provides controls for specifying Profile (UserName), Recipient,
    ' LogonUI, and NewSession

    MAPISession1.DownLoadMail = False
    MAPISession1.NewSession = (checkboxNewSession = vbChecked)
    MAPISession1.LogonUI = (checkboxLogonUI = vbChecked)
    MAPISession1.UserName = textboxProfile.Text
    MAPISession1.SignOn

    MAPIMessages1.SessionID = MAPISession1.SessionID

    MAPIMessages1.Compose
    MAPIMessages1.RecipIndex = 0
    MAPIMessages1.RecipAddress = textboxRecipient.Text
    MAPIMessages1.MsgSubject = "My Subject"
    MAPIMessages1.MsgNoteText = "My Message Body"

    ' Although the actual intent is to send mail without the Dialog box, we
    ' set VDailog:=True here in order to see who the mail Sender is (i.e.,
did
    ' we get the expected profile).

    MAPIMessages1.Send vDialog:=True

    MAPISession1.SignOff

End Sub



Wed, 18 Jun 1902 08:00:00 GMT  
 MAPI UserName - Profile - Sender
Simple MAPI does not support this, and OE5 does not have an automation
interface.... I think 3rd party products are the only way to go here.

--
MichKa
(insensitive fruitarian)

random junk of dubious value, a multilingual website, the
54-language TSI Form/Report to Data Access Page Wizard,
and lots of replication "stuff" at the (no scripts required!)
http://www.trigeminal.com/


Quote:
> I can successfully use MAPI to send email (MS Outlook Express verision 5),
> but with one shortcoming:  I want to be able to override the Default
Account
> Profile.

> Assume the I have 2 email accounts: Grapefruit (default) and Banana.  Both
> are valid mail accounts and both work in Outlook Express.  When I send
mail
> via OE manually, the send mail dialog shows (by default) the Grapefruit
> account in the From box, but if I want the mail to be sent from the Banana
> account, I can simply select that acount from the combo box, and the
> recipient receives mail from Banana.

> I want to achieve the same using VB6.  The following code send mail just
> fine but always uses the default account, and I can find no way to
override
> this.  I've tried various combinations of UserName, LogonUI, and
NewSession
> properties.  I've searched the Microsoft MSDN site to no avail.

> HELP!!!
> ---------------------------------------------------
> Private Sub SendMail()

>     ' A Form provides controls for specifying Profile (UserName),
Recipient,
>     ' LogonUI, and NewSession

>     MAPISession1.DownLoadMail = False
>     MAPISession1.NewSession = (checkboxNewSession = vbChecked)
>     MAPISession1.LogonUI = (checkboxLogonUI = vbChecked)
>     MAPISession1.UserName = textboxProfile.Text
>     MAPISession1.SignOn

>     MAPIMessages1.SessionID = MAPISession1.SessionID

>     MAPIMessages1.Compose
>     MAPIMessages1.RecipIndex = 0
>     MAPIMessages1.RecipAddress = textboxRecipient.Text
>     MAPIMessages1.MsgSubject = "My Subject"
>     MAPIMessages1.MsgNoteText = "My Message Body"

>     ' Although the actual intent is to send mail without the Dialog box,
we
>     ' set VDailog:=True here in order to see who the mail Sender is (i.e.,
> did
>     ' we get the expected profile).

>     MAPIMessages1.Send vDialog:=True

>     MAPISession1.SignOff

> End Sub



Wed, 18 Jun 1902 08:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Help: MAPI and use of UserName/Profile and Password

2. Finding Sender's Address in EMail:No MAPI Object Model

3. MAPI:Change email address of sender

4. Mapi sender name

5. Help - VB 5.0 MAPI Send Mail as other sender

6. Mapi sender name

7. MAPI/CDO Sender address

8. MAPI & email sender client application

9. Mapi sender name

10. MAPI & email sender client application

11. Mapi problem using multiple mailboxes/profiles..

12. Mapi Problem using multiple mailboxes/profiles..

 

 
Powered by phpBB® Forum Software