Page 1 of 1

How to send email via hmg program ?

Posted: Thu Mar 10, 2011 2:51 am
by huangchenmin
Dear all
I would like to build a app that could send the result vis email in background.
Therefore I could receive result daily and know the progress.
How do I do to send email? excute outlook ?
Please Help!
Best Regards
chen min

Re: How to send email via hmg program ?

Posted: Thu Mar 10, 2011 3:48 am
by Rathinagiri
No, we need not use Outlook.

We can use HBTIP instead. Here you can see samples too.

http://hmgforum.com/viewtopic.php?f=5&t=260

Re: How to send email via hmg program ?

Posted: Fri Mar 11, 2011 1:47 am
by huangchenmin
rathinagiri wrote:No, we need not use Outlook.

We can use HBTIP instead. Here you can see samples too.

http://hmgforum.com/viewtopic.php?f=5&t=260
Dear rathinagiri:
Thanks for your support.
Should I need to include C:\hmg\HARBOUR\lib\libhbtip.a other than HMG.ch ?
I didi noe see the 『include C:\hmg\HARBOUR\lib\libhbtip.a』in sample.
Best Regards
chen min

Re: How to send email via hmg program ?

Posted: Fri Mar 11, 2011 4:44 am
by Rathinagiri
IMHO, it is already included in the linking process. We can straight away use the functions.

Re: How to send email via hmg program ?

Posted: Thu Mar 17, 2011 4:09 am
by huangchenmin
rathinagiri wrote:IMHO, it is already included in the linking process. We can straight away use the functions.
Thank you very much!
Best Regards

Re: How to send email via hmg program ?

Posted: Fri Mar 18, 2011 6:46 am
by mol
I'm using such a code:
(You need to change your account and password)

Code: Select all


function SendMail
	param cSubject, cBody
	LOCAL oMail, cData, i, oAttach
	local lret
	local xto := "akord@mol-systemy.nazwa.pl"
	local cFrom := "akord@kern-liebers.nazwa.pl"
	local cServer := "kern-liebers.nazwa.pl"
	local nPort := 587
	local xCC := "mol@pro.onet.pl"
	local xBCC := "mol68@tlen.pl"
	local aFiles := NIL
	local cUser := "akord@kern-liebers.nazwa.pl"
	local cPass := "************"
	local cPopServer := "kern-liebers.nazwa.pl"
	local nPriority := 1
	local lRead := .f.	//  confirmation request
	local bTrace := .f.		//create transmission log?
	local lPopAuth := .f.	// login into POP server
	local lNoAuth := .f.
	local nTimeOut := 500
	local cReplyTo := ""
	local lTLS := .f.  	// do not change! causes crash!
	local cSMTPPass := "***********"
	local cCharset := "windows-1250"
	local cEncoding := ""
	
	cBody += eol + dtoC(date())+" "+time()
	WAIT WINDOW "Trwa wysyłanie wiadomości e-mail: " + cBody NOWAIT
	lret := hb_SendMail( cServer, nPort, cFrom, xTo, xCC, xBCC, cBody, cSubject, aFiles, cUser, cPass, cPopServer,;
 nPriority, lRead, bTrace, lPopAuth, lNoAuth, nTimeOut, cReplyTo, lTLS, cSMTPPass, cCharset, cEncoding ) 
 /*
   cServer    -> Required. IP or domain name of the mail server
   nPort      -> Optional. Port used my email server
   cFrom      -> Required. Email address of the sender
   xTo        -> Required. Character string or array of email addresses to send the email to
   xCC        -> Optional. Character string or array of email adresses for CC (Carbon Copy)
   xBCC       -> Optional. Character string or array of email adresses for BCC (Blind Carbon Copy)
   cBody      -> Optional. The body message of the email as text, or the filename of the HTML message to send.
   cSubject   -> Optional. Subject of the sending email
   aFiles     -> Optional. Array of attachments to the email to send
   cUser      -> Required. User name for the POP3 server
   cPass      -> Required. Password for cUser
   cPopServer -> Required. POP3 server name or address
   nPriority  -> Optional. Email priority: 1=High, 3=Normal (Standard), 5=Low
   lRead      -> Optional. If set to .T., a confirmation request is send. Standard setting is .F.
   bTrace     -> Optional. If set to .T., a log file is created (smtp-<nNr>.log). Standard setting is NIL.
                           If a block is passed, it will be called for each log event with the message a string, no param on session close.
   lPopAuth   -> Optional. Do POP3 authentication before sending mail.
   lNoAuth    -> Optional. Disable Autentication methods
   nTimeOut   -> Optional. Number os ms to wait default 20000 (20s)
   cReplyTo   -> Optional.
   */ 
  WAIT CLEAR
RETURN lret


Re: How to send email via hmg program ?

Posted: Thu Apr 21, 2011 11:38 am
by huangchenmin
mol wrote:I'm using such a code:
(You need to change your account and password)

Code: Select all


function SendMail
........
Sorry for reply late.
I been busy for urgen project.
I will read your code lately.
Best Regards
chen min

Re: How to send email via hmg program ?

Posted: Sun Apr 24, 2011 7:29 pm
by mol
I hope, it wa useful...