mail from desktop application

anandknr

Member
Hi all,

I am developing an application in 10.2b (.net gui). I need to my application to send email. Can it be possible for desktop applications ?then how ? please explain as I am new in this.

Waiting for a reply,
Anand
 
Code:
DEFINE VARIABLE objOutlook       AS COM-HANDLE NO-UNDO.
DEFINE VARIABLE objOutlookMsg    AS COM-HANDLE NO-UNDO.
DEFINE VARIABLE objOutlookAttach AS COM-HANDLE NO-UNDO.
DEFINE VARIABLE objOutlookRecip  AS COM-HANDLE NO-UNDO.
 
CREATE "Outlook.Application" objOutlook.
 
objoutlookMsg         = objOutlook:CreateItem(0).
objOutlookRecip       = objOutlookMsg:Recipients:Add("[EMAIL="MyEmail@AAA.com"]MyEmail@AAA.com[/EMAIL]").
objOutlookRecip:Type  = 1.
objOutlookMsg:Subject = "Testing OutLook Email Function".
objOutlookMsg:Body    = "Hello ... some text ... !".
 
objOutlookMsg:Attachments:Add("C:\MyFolder\MyAttachment.txt").
objOutlookRecip:Resolve.
objOutlookMsg:Send.
objoutlook:Quit().
 
RELEASE OBJECT objOutlook.
RELEASE OBJECT objOutlookMsg.
RELEASE OBJECT objOutlookRecip.
 
Just to clarify... you do need an smtp server, but you don't necessarily need to install one just for your application. If your isp (or your customer's) already provides one, smtpmail.p can use it.

You can also use a 3rd party smtp server. For instance, google provides one that lets you send mail from your gmail account (http://mail.google.com/support/bin/answer.py?answer=13287). Note that it requires tls/ssl and I'm not sure smtpmail.p supports that, but the idea is that you can find an existing smtp and use it as long as you have an account.
 
Back
Top