March 22nd, 2004, 12:10 AM
Join Date: Mar 2004
Time spent in forums: < 1 sec
Reputation Power: 0
"From" Address wants to change dynamically from VB using MAPI Componenets.
Please help me to solve my problem.
Using MAPI Componenets I am able to send Emails successfully. Now I want to send Emails behalf of my superior. He added me in his delegates list. I am able to send emails behalf of him from Outlook. I want to do this job throough VB. I want to pass the "From" address in runtime.
I tried with using of MAPIMessage. MsgOrigDisplayName = users.username -- Error: 383 Read-Only Property.
Here the function:
Public Function SendMessage(ByVal SendTo As String, ByVal Subject As String, Attachment() As String) As Boolean
'automatically fill up the email server, ie. groupwise with the information
'such as subject and attachment.
On Error GoTo Err_Handler
Dim I As Integer
.SessionID = m_Form.Session.SessionID
If Subject <> "" Then .MsgSubject = Subject
'populate the sent to text box automatically if
'the project provides an email address.
If Not SendTo = "" Then
.RecipIndex = 0
.RecipType = 1 'RECIP_TYPE_TO
.RecipDisplayName = SendTo
' .MsgOrigDisplayName = user.username
'.RecipAddress = SendTo
'we have to provide more than one space for each attachment.
'otherwise an error will be generated when using groupwise
'outlook does not have this problem.
If frmShipment.blshipment = False Then
.MsgNoteText = Space(UBound(Attachment) + 1) & vbCrLf _
& "The attached file needs PDF Reader to open, if you don't have the PDF Reader software on your machine, you can download the software FREE from http://www.adobe.com/products/acrobat/alternate.html"
.MsgNoteText = Space(UBound(Attachment) + 1)
For I = LBound(Attachment) To UBound(Attachment)
If Attachment(I) <> "" Then
.AttachmentIndex = .AttachmentCount
.AttachmentPosition = .AttachmentIndex
.AttachmentPathName = (Attachment(I))
If frmUnconfirmedShip.blEmail = True Then
.Send False 'send email Directly
.Send True 'display the send dialog window.
On Error Resume Next
AppActivate "Mail From"
m_ErrorMessage = ""
SendMessage = True
m_ErrorMessage = Err.Number & " " & Err.Description
SendMessage = False
Appreciable for early response. TQ.