How to send email via hmg program ?

General Help regarding HMG, Compilation, Linking, Samples

Moderator: Rathinagiri

Post Reply
huangchenmin
Posts: 157
Joined: Mon Jun 07, 2010 2:24 am

How to send email via hmg program ?

Post 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
User avatar
Rathinagiri
Posts: 5482
Joined: Tue Jul 29, 2008 6:30 pm
DBs Used: MariaDB, SQLite, SQLCipher and MySQL
Location: Sivakasi, India
Contact:

Re: How to send email via hmg program ?

Post 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
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.
huangchenmin
Posts: 157
Joined: Mon Jun 07, 2010 2:24 am

Re: How to send email via hmg program ?

Post 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
User avatar
Rathinagiri
Posts: 5482
Joined: Tue Jul 29, 2008 6:30 pm
DBs Used: MariaDB, SQLite, SQLCipher and MySQL
Location: Sivakasi, India
Contact:

Re: How to send email via hmg program ?

Post by Rathinagiri »

IMHO, it is already included in the linking process. We can straight away use the functions.
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.
huangchenmin
Posts: 157
Joined: Mon Jun 07, 2010 2:24 am

Re: How to send email via hmg program ?

Post 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
User avatar
mol
Posts: 3825
Joined: Thu Sep 11, 2008 5:31 am
Location: Myszków, Poland
Contact:

Re: How to send email via hmg program ?

Post 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

huangchenmin
Posts: 157
Joined: Mon Jun 07, 2010 2:24 am

Re: How to send email via hmg program ?

Post 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
Post Reply