Home » Developer & Programmer » Forms » Mail with OLE2 (using static mail address for Sender) (Forms 6i)
Mail with OLE2 (using static mail address for Sender) [message #443124] Fri, 12 February 2010 16:27 Go to next message
kamu
Messages: 5
Registered: September 2008
Junior Member
Hi,

i can send e-mail with forms using ole2. But i want to use pre-defined e-mail address for SENDER. OLE2 uses outlook account so sender is default account mail address. How can i change sender mail adres on run time.

My code:
DECLARE
	OutlookApp OLE2.OBJ_TYPE;
	NameSpace OLE2.OBJ_TYPE;
	MailItem OLE2.OBJ_TYPE;
	OLEPARAM OLE2.LIST_TYPE;
	Send OLE2.OBJ_TYPE;
	Attachments OLE2.OBJ_TYPE;
	Attachment_dummy OLE2.OBJ_TYPE;
Begin	
	OutlookApp := OLE2.CREATE_OBJ('Outlook.Application');
	OLEPARAM := OLE2.CREATE_ARGLIST;
	
	OLE2.ADD_ARG(OLEPARAM,'MAPI');
	NameSpace := 
	OLE2.INVOKE_OBJ(OutlookApp,'GetNameSpace',OLEPARAM) ;
	OLE2.DESTROY_ARGLIST(OLEPARAM);
	
	OLEPARAM := OLE2.CREATE_ARGLIST;
	OLE2.ADD_ARG(OLEPARAM,0);
	MailItem := OLE2.INVOKE_OBJ(OutlookApp,'CreateItem',OLEPARAM);
	OLE2.DESTROY_ARGLIST(OLEPARAM);
	
	OLE2.SET_PROPERTY(MailItem,'To',:blok01.to);
	OLE2.SET_PROPERTY(MailItem,'Cc',:blok01.cc);
	OLE2.SET_PROPERTY(MailItem,'Bcc',:blok01.bcc);
	OLE2.SET_PROPERTY(MailItem,'Subject',:blok01.subject);
	OLE2.SET_PROPERTY(MailItem,'Body', :blok01.body);
	
			Attachments := OLE2.GET_OBJ_PROPERTY(MailItem,'Attachments');
			OLEPARAM := OLE2.CREATE_ARGLIST;
			OLE2.ADD_ARG(OLEPARAM,:blok01.attach1);
			Attachment_dummy := OLE2.INVOKE_OBJ(Attachments,'add',OLEPARAM);
			OLE2.DESTROY_ARGLIST(OLEPARAM);

	Send := OLE2.INVOKE_OBJ(MailItem,'Send');

	OLE2.INVOKE(MailItem,'Display');
	OLE2.RELEASE_OBJ(MailItem);
	OLE2.RELEASE_OBJ(NameSpace);
	OLE2.RELEASE_OBJ(OutlookApp);
END;



I want to change SENDER mail address. Is that possible.

Thank you for your helps...

Musti
Re: Mail with OLE2 (using static mail address for Sender) [message #443125 is a reply to message #443124] Fri, 12 February 2010 17:24 Go to previous messageGo to next message
ThomasG
Messages: 3212
Registered: April 2005
Location: Heilbronn, Germany
Senior Member
Just a stab in the dark since I don't know it, but have you tried "From" as a property?

OLE2.SET_PROPERTY(MailItem,'From',:blok01.???);
Re: Mail with OLE2 (using static mail address for Sender) [message #443215 is a reply to message #443124] Sat, 13 February 2010 14:46 Go to previous messageGo to next message
kamu
Messages: 5
Registered: September 2008
Junior Member
Thanks for your answer my friend. Yes i tried like that but it didn't work (App. used default outlook account). I think we must send an password with "from mail address" but i couldn't find structure.
Re: Mail with OLE2 (using static mail address for Sender) [message #446928 is a reply to message #443215] Thu, 11 March 2010 00:30 Go to previous message
djmartin
Messages: 10181
Registered: March 2005
Location: Surges Bay TAS Australia
Senior Member
Account Moderator
Sorry that I have been so long in replying. Have you solved your problem?

I googled "OLE2.CREATE_OBJ 'Outlook.Application'" and found quite a few entries that purport to send emails via outlook. I can only assume that they use the default email account.

David
Previous Topic: Database connectivity issue after putting customized login form
Next Topic: Insert/Update/Delete single record at a time
Goto Forum:
  


Current Time: Fri Sep 20 10:45:46 CDT 2024