Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

MAPI Change "From" Address

Status
Not open for further replies.

Albano

Instructor
Joined
Dec 11, 2000
Messages
221
Location
PT
Hi,

I'm using a Mapi Based email sender code, and I like to change the sender (From) address, someone knows whow.

Thanks,

Code:
CampoCC="teste@teste.pt"
Server.ScriptTimeout=18000 ' Equivale a 5 horas
'for i=0 to 99
Dim mapiSession, mapiMessage, mapiRecipient

Dim oMyItem

Set mapiSession = Server.CreateObject("MAPI.Session")
'mapiSession.Logon "Albano", "", False


'objSession.Logon( [profileName] [, profilePassword] [, showDialog] [, newSession] [, parentWindow] [, NoMail] [, ProfileInfo] )
mapiSession.Logon "", "", False, True, 0, True,"GEAC01XBAL1" & vbLf & "gp66116"


Set mapiMessage = mapiSession.Outbox.Messages.Add()
mapiMessage.Subject = "teste"'Request.Form("txtSubject")
mapiMessage.Text = "teste 3"'Request.Form("txtBody")

codTier="123456"

nomeFicheiro = "/exportacao/" & codTier & ".xls"
nFicheiro = Server.MapPath(nomeFicheiro)


Set mapiRecipient = mapiMessage.Recipients.Add()
mapiRecipient.Name = "teste2@teste.pt" 'Request.Form("txtTo")
mapiRecipient.Type = 1 'CdoTo

mapiRecipient.Resolve

Set mapiRecipient2 = mapiMessage.Recipients.Add()
mapiRecipient2.Name =cstr(CampoCC) 'Request.Form("txtTo")
mapiRecipient2.Type = 2 'CdoCc

mapiRecipient2.Resolve

Set Attachment = mapiMessage.Attachments.Add

Attachment.Type = 1 'ActMsgFileData

Attachment.Source = nFicheiro

Attachment.ReadFromFile nFicheiro

mapiMessage.Update

'Set objSentItems = mapiSession.GetDefaultFolder(3).Messages.Add()

mapiMessage.Send




mapiSession.Logoff

Set objSentItems = Nothing
Set mapiRecipient = Nothing
Set mapiRecipient2 = Nothing
Set mapiMessage = Nothing
Set mapiSession = Nothing
 
i would suppose you could change the logon account, or use mapimessage.from = "Address"

[thumbsup2]DreX
aKa - Robert
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top