MyPage is a personalized page based on your interests.The page is customized to help you to find content that matters you the most.


I'm not curious

Send MAPI E-mail in PowerBuilder - Outlook

Published on 02 September 16
1542
0
1
// Create a fuction eg...
// send_email(string a_to,String a_body,String a_subject)
// Return Integer
//Outlook mail should be opened in your desktop or it should be running
OLEObject lole_application, lole_namespace, lole_oItem
OLEObject lole_Attachment, lole_safeItem

TRY
lole_application = CREATE OLEObject
lole_namespace = CREATE OLEObject
lole_oItem = CREATE OLEObject
lole_Attachment = CREATE oleobject
lole_safeItem = CREATE OLEObject

lole_application.ConnectToNewObject("Outlook.Application")
lole_namespace = lole_application.GetNamespace("MAPI")
lole_namespace.Logon

lole_oItem = lole_application.CreateItem(0)

lole_oItem.To=a_to
lole_oItem.Subject = a_subject
lole_oItem.Body=a_body
lole_oItem.send()
MessageBox("Mail Sent","Mail Sent Successfully")


CATCH (RuntimeError er2)
MessageBox("Failed " ,"Error in sending the email")
FINALLY
DESTROY lole_application
DESTROY lole_namespace
DESTROY lole_oItem
DESTROY lole_Attachment
DESTROY lole_safeItem
END TRY

RETURN 0







// Create a fuction eg...// send_email(string a_to,String a_body,String a_subject)

// Return Integer

//Outlook mail should be opened in your desktop or it should be running

OLEObject lole_application, lole_namespace, lole_oItem

OLEObject lole_Attachment, lole_safeItem

TRY

lole_application = CREATE OLEObject

lole_namespace = CREATE OLEObject

lole_oItem = CREATE OLEObject

lole_Attachment = CREATE oleobject

lole_safeItem = CREATE OLEObject

lole_application.ConnectToNewObject("Outlook.Application")

lole_namespace = lole_application.GetNamespace("MAPI")

lole_namespace.Logon

lole_oItem = lole_application.CreateItem(0)

lole_oItem.To=a_to

lole_oItem.Subject = a_subject

lole_oItem.Body=a_body

lole_oItem.send()

MessageBox("Mail Sent","Mail Sent Successfully")

CATCH (RuntimeError er2)

MessageBox("Failed " ,"Error in sending the email")

FINALLY

DESTROY lole_application

DESTROY lole_namespace

DESTROY lole_oItem

DESTROY lole_Attachment

DESTROY lole_safeItem

END TRY

RETURN 0

This blog is listed under Development & Implementations and Telecommunications Community

Post a Comment

Please notify me the replies via email.

Important:
  • We hope the conversations that take place on MyTechLogy.com will be constructive and thought-provoking.
  • To ensure the quality of the discussion, our moderators may review/edit the comments for clarity and relevance.
  • Comments that are promotional, mean-spirited, or off-topic may be deleted per the moderators' judgment.
You may also be interested in
Awards & Accolades for MyTechLogy
Winner of
REDHERRING
Top 100 Asia
Finalist at SiTF Awards 2014 under the category Best Social & Community Product
Finalist at HR Vendor of the Year 2015 Awards under the category Best Learning Management System
Finalist at HR Vendor of the Year 2015 Awards under the category Best Talent Management Software
Hidden Image Url

Back to Top