How do I set sender's address in PB10 using Outlook redemption?

Posted on 2004-11-29
Last Modified: 2013-12-26
I have installed and able to send emails from a PB10 application.  I am able to bypass the security prompt (good bennie), but I need to set pr_sender_email_address value to "".  I have found code that allows me to view the sender's email address, but I need to set it.

The code that I have so far is:

string ls_sendto, ls_subject, ls_message, ls_copyto
boolean lb_goodtosend
integer li_array, rc
oleobject oleSafeMailItem
oleobject oleTmp
oleobject oleOutlook
oleobject oleNameSpace

//First we need to capture the subject line and the mail text
ls_sendto = Trim(sle_sendto.Text)
ls_copyto = Trim(sle_copyto.Text)
ls_subject = Trim(sle_subject.Text)
ls_message = Trim(mle_message.Text)

//Now we need to know if we can send the data
lb_goodtosend = True

If ls_sendto = "" Then
      lb_goodtosend = False
End If

If ls_subject = "" Then
      lb_goodtosend = False
End If

If ls_message = "" Then
      lb_goodtosend = False
End If

If lb_goodtosend = True Then

      oleOutlook = create oleobject
      rc = oleOutlook.ConnectToNewObject("outlook.application")
      If rc = 0 Then
            oleNameSpace = oleOutlook.GetNameSpace("MAPI")
            oleNameSpace.Logon("outlook", "G3tMyM@il01$", true, true)

            oleSafeMailItem = create oleobject
            rc = oleSafeMailItem.ConnectToNewObject("Redemption.SafeMailItem")

            If rc = 0 Then
                  oleTmp = create oleobject
                  oleTmp = oleOutlook.CreateItem(0)
                  oleSafeMailItem.Item = oleTmp
                  oleSafeMailItem.Subject = ls_subject

                  MessageBox("Mail Error", &
                        "Your email could not be sent.  Please contact IT.~r~n" + &
                        "The SafeMailItem  - ConnectToNewObject~r~n" + &
                        "failed with a return code of " + String(rc) + ".", &
                        StopSign!, &
            End If
            MessageBox("Mail Error", &
                  "Your email could not be sent.  Please contact IT.~r~n" + &
                  "The Outlook Application  - ConnectToNewObject~r~n" + &
                  "failed with a return code of " + String(rc) + ".", &
                  StopSign!, &
      End If

End If

if isValid(oleSafeMailItem) then
      destroy oleSafeMailItem
End If

if isValid(oleNameSpace) then
      destroy oleNameSpace
end if

if isValid(oleOutlook) then
      destroy oleOutlook
end if

I think that I need to use MapiUtils from Outlook Redemption, but I do not know how to code it.  Any suggestions out there?
Question by:BooBoo2004
    1 Comment
    LVL 18

    Accepted Solution


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    Here is a helpful source code for C++ Builder programmers that allows you to manage and manipulate HTML content from C++ code, while also handling HTML events like onclick, onmouseover, ... Some objects defined and used in this source include: …
    Jaspersoft Studio is a plugin for Eclipse that lets you create reports from a datasource.  In this article, we'll go over creating a report from a default template and setting up a datasource that connects to your database.
    The viewer will learn how to use and create keystrokes in Netbeans IDE 8.0 for Windows.
    The viewer will learn how to synchronize PHP projects with a remote server in NetBeans IDE 8.0 for Windows.

    779 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now