Results 1 to 6 of 6
  1. #1
    4 Star Lounger
    Join Date
    Feb 2001
    Location
    Gillingham, Kent, England
    Posts
    511
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Use of the MAPI control (Access 97 SR2 or VB6)

    Does anyone know if it's possible to set the cc and bcc fields when using the MAPI session/MAPI messages method of sending email?
    Also, using the same method, is it possible to use rich text (formatted, fonts/bold etc) or an OLE object for the main body of the message or is it limited to plain text?

    Current method is as follows with a MAPI session control and a MAPI message control:

    MAPISession1.SignOn
    DoEvents
    Mapmess.SessionID = MAPISession1.SessionID
    Mapmess.Compose
    Mapmess.MsgNoteText = "Is formatted text possible here?"
    Mapmess.RecipAddress = "philipj@education.co.uk"
    ' Mapmess.ResolveName
    Mapmess.MsgSubject = "Searching for an answer"
    Mapmess.Send False
    MAPISession1.SignOff

    Any help would be much appreciated.

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Use of the MAPI control (Access 97 SR2 or VB6)

    You can add recipients to a MAPIMessage by increasing RecipIndex. The default value is 0. The property RecipType refers to the currently indexed recipient; it can be set to mapToList, mapCcList or mapBccList.

    Example:

    With MapMess
    ' Add standard recipient
    .RecipAddress = "philipj@education.co.uk"
    .RecipType = mapToList
    ' Add recipient to Cc list
    .RecipIndex = .RecipIndex + 1
    .RecipAddress = "billg@microsoft.com"
    .RecipType = mapCcList
    ' Add another recipient to Cc list
    .RecipIndex = .RecipIndex + 1
    .RecipAddress = "woody@wopr.com"
    .RecipType = mapCcList
    End With

  3. #3
    4 Star Lounger
    Join Date
    Feb 2001
    Location
    Gillingham, Kent, England
    Posts
    511
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Use of the MAPI control (Access 97 SR2 or VB6)

    Wow, excellent, that worked perfectly and in both VBA and VB.
    Thanks Hans, you're a Genius.

  4. #4
    4 Star Lounger
    Join Date
    Feb 2001
    Location
    Gillingham, Kent, England
    Posts
    511
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Use of the MAPI control (Access 97 SR2 or VB6)

    Another quick question that I think I know the answer to already. Is there a command to change where the email was sent from. i.e. I have reps in the field who may send emails to customers, but preferably i'd like the main company email address to be used if the customer replies to the email.

    I'd take a guess that to get this affect i'd need to change who the email is from, which is fine. i.e if I send it from phil.jeary@blueyonder.co.uk, it is sent with the address philipj@education.co.uk instead. Or if the email is replied to the reply would go to philipj@education.co.uk instead.

    I know emails can be sent from SQL server and change the sender address but I don't know if its possible with other programs due to security etc.

  5. #5
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Use of the MAPI control (Access 97 SR2 or VB6)

    According to the help file, the MsgOrigAddress property (i.e. the e-mail address of the sender) is read-only. This has to do with security, no doubt.

    In the Outlook object model, you can specify a SentOnBehalfOfName, but I don't know if this is available for a MAPIMessage. The SenderName is read-only in Outlook too, again for security reasons.

  6. #6
    4 Star Lounger
    Join Date
    Feb 2001
    Location
    Gillingham, Kent, England
    Posts
    511
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Use of the MAPI control (Access 97 SR2 or VB6)

    (Edited by HansV to activate URL - see <!help=19>Help 19<!/help>)

    The way SQL changes the email sender still leaves a trace in the properties. It shows the message was received from one of our servers but displays the from address as our support email address.

    The dll used for this is described here: http://sqldev.net/xp/xpsmtp.htm

    I might try contacting them to see if they ever made a VB version.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •