Change Outlook user (automation) ???

Hi @ all Im using automation to create and send Emails via Outlook XP and it works fine! Now i want to create and send the Email trough another Outlook-Account, for example: Automation creates and sent the Email via outlook-account BC (my account; outlook identifies me as BC through NT/2K-Authorization-no login required cause of Exchange Server). Now I want to create and send that Email trough another (not mine) outlook-account. How can I change the outlook account during the time of creating and sending the Email??? Has someone a clue for me? ;)) Thanks! Ben Benjamin Crause webmaster@amargosasun.de Germany

Try: MAPISession.UserName := “username”; MAPISession.Password := “Password”; MAPISession.Signon; Valentin Gvozdev Andel Jewelry Inc.

Thanks for ya answer. The MAPI is the usually way for sending Emails, but I use the Outlook-Automation ;)) Im doing this: VARs Name DataType Subtype Length mxOutlook Automation Unknown Automation Server.Application mxMailItem Automation Unknown Automation Server.MailItem mxItems Automation Unknown Automation Server.Items mxRecipients Automation Unknown Automation Server.Recipients mxOutlookHelper Automation ‘Fin2Outlook Library’.Helpers mxInspector Automation Unknown Automation Server._Inspector MAPISession OCX Microsoft MAPI Session Control, version 6.0 CLEAR(mxOutlook); IF CREATE(mxOutlook,FALSE) THEN BEGIN CLEAR(mxOutlookHelper); CREATE(mxOutlookHelper,FALSE); ixNameSpace := mxOutlook.GetNamespace(‘MAPI’); ixFolder:= ixNameSpace.GetDefaultFolder(4); IF abHTML THEN BEGIN mxMailItem:=ixFolder.Items.Add(‘IPM.Note’); mxMailItem.HTMLBody:=’’; IF abAufgabe THEN mxMailItem.HTMLBody:=mxMailItem.HTMLBody+STRSUBSTNO(‘

Neue %1

’,atSubject); END ELSE BEGIN mxMailItem:=ixFolder.Items.Add(‘IPM.Note.NavisionMail_RTF’); mxMailItem.Body:=’’; END; mxMailItem.Subject:=atSubject; mxRecipients:=mxMailItem.Recipients; mbItemOK:=TRUE; END; atEmail := ‘;’ + atEmail + ‘;’; mxMailItem.BCC(mxMailItem.BCC + atEmail); //Add some text to the Email mxMailItem.DeleteAfterSubmit(abDelete); //Deletes the Email after submit mxMailItem.Categories(’’); mxMailItem.Send; That works ;)) But, as described above, I want to send the Email trough a special Outlook-Account! To use the MAPI you mentioned has no affect because it doesnt matters to the Outlook-Automation-Controller, I did this before the above code: MAPISession.UserName := atProfil; MAPISession.Password := atPassword; MAPISession.NewSession := TRUE; MAPISession.LogonUI := FALSE; MAPISession.DownLoadMail := FALSE; IF MAPISession.SessionID = 0 THEN MAPISession.SignOn; Note: We are using MS Outlook XP-SP 1 with MS Exchange Server Greetz Ben Benjamin Crause webmaster@amargosasun.de Germany

A I tried your MAPI-Solution in another way. Now I get the Error-Message: The call to Member SignOn failed. MAPISession returned the following message: Login has failed. What has the MAPISession.username to be? a name on my system? On the exchange-server or what? I dont get it - please help! Ben Benjamin Crause webmaster@amargosasun.de Germany

Hi Amargosa,

I use Automation to send emails and works fine. The way to send with another account is loggin before creating the EmailItem object, my lines are:

CREATE(OLAppl);
OLNamespace := OLAppl.GetNamespace(‘MAPI’);
OLNamespace.Logon(nameAcc,passAcc,TRUE,FALSE);
OLMailItem := OLAppl.CreateItem(0);

The only problem is that nameAcc and passAcc represents an Outlook profile of the computer you’re sending from, so you need to create the profile in Outlook before.
Hope it helps !! [;)]