hb_sendmail()
Posted: Wed Jun 16, 2010 7:04 pm
Hi All,
Has anyone a working sample of hb_sendmail()?
TIA.
Has anyone a working sample of hb_sendmail()?
TIA.
Exclusive forum for HMG, a Free / Open Source xBase WIN32/64 Bits / GUI Development System
http://mail.hmgforum.com/
Sure.Roberto Lopez wrote:Hi All,
Has anyone a working sample of hb_sendmail()?
Code: Select all
cSMTPServer := "smtp.freemail.ru"
cPopServer := "pop.freemail.ru"
cFrom := "gfilatov@freemail.ru"
cTo := "recipient@domain.com"
cSMTPPassWord := "MySmtpPassword"
// 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 )
MsgInfo( iif(hb_SendMail( cSMTPServer,;
NIL,;
cFrom,;
cTo,;
NIL /* CC */,;
NIL /* BCC */,;
"test: body",;
"test: subject",;
{"sendmail.prg"} /* attachment */,;
cFrom,;
cSMTPPassword,;
cPopServer,;
NIL /* nPriority */,;
NIL /* lRead */,;
.F. /* lTrace */,;
.T. /* lPopAuth */,;
.F. /* lNoAuth */,;
NIL /* nTimeOut */,;
NIL /* cReplyTo */,;
.F. /* lTLS */,;
cSMTPPassWord ), "Successfully", "Unsuccessfully"), "Result" )
Thanks!gfilatov wrote:Sure.Roberto Lopez wrote:Hi All,
Has anyone a working sample of hb_sendmail()?
Please take a look for the following working code using free mail server with authentication:
Hope that helpsCode: Select all
cSMTPServer := "smtp.freemail.ru" cPopServer := "pop.freemail.ru" cFrom := "gfilatov@freemail.ru" cTo := "recipient@domain.com" cSMTPPassWord := "MySmtpPassword" // 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 ) MsgInfo( iif(hb_SendMail( cSMTPServer,; NIL,; cFrom,; cTo,; NIL /* CC */,; NIL /* BCC */,; "test: body",; "test: subject",; {"sendmail.prg"} /* attachment */,; cFrom,; cSMTPPassword,; cPopServer,; NIL /* nPriority */,; NIL /* lRead */,; .F. /* lTrace */,; .T. /* lPopAuth */,; .F. /* lNoAuth */,; NIL /* nTimeOut */,; NIL /* cReplyTo */,; .F. /* lTLS */,; cSMTPPassWord ), "Successfully", "Unsuccessfully"), "Result" )
Thanks for the offer.Alex Gustow wrote:Hi Roberto!
I created "mail robot"few months ago (recieving mails with attaches, analyzing mail's content, saving attaches to pre-defined subfolders, send "auto-answers", creating HTML-log).
If needed I can translate this (from Rus to Eng) and "designed" as a sample.
(it's console app compiled with xHarbour - I had some strange troubles with compiling it with "simple" Harbour)
What's the question(s) you have about Hb-SendMail()?
Ok.Roberto Lopez wrote: Thanks!
I've activated trace and I've found the error 512.Roberto Lopez wrote:
Anyway, there is a way to know the error code, to find what exactly is happening?
Roberto,Roberto Lopez wrote:I've activated trace and I've found the error 512.Roberto Lopez wrote:
Anyway, there is a way to know the error code, to find what exactly is happening?
If someone can successfully access gmail smtp, please, let me know.
At the moment, I'm using blat. It connects google without problems.
Hope that give you an idea...
2009-08-07 04:11 UTC+0200 Viktor Szakats (harbour.01 syenar.hu)
* contrib/hbtip/sendmail.prg
! Raised timeout to 1000 from 100.
This was the remaining error, now it should be okay.
; This means Harbour now support SMTP through SSL, which
practically means "gmail support", Google Apps for
Domain mailboxes also work.
Remember to build hbtip with HB_HAS_OPENSSL option and
link with hbssl lib + openssl libs. On *nixes this is
a no-brainer. On Windows, OpenSSL either needs to be
built from source, or pre-built binaries downloaded
(from this file: http://www.slproweb.com/download/Win32O ... 0_9_8k.exe
from this link: http://www.slproweb.com/products/Win32OpenSSL.html)
and linked. Due to usual chaos regarding lib names
on Windows, default names in contrib\hbssl\hbssl.hbc may
need to be adjusted to local environment.
MinGW and MSVC are supported by OpenSSL on Windows for
static linking, the .dll version should work for all
compilers, I've only tested MinGW and MSVC though.
+ contrib/hbtip/tests/gmail.prg
+ Added simple test program to send mails through gmail.
...
I don't knew that.gfilatov wrote: Roberto,
AFAIR you will need to recompile the Harbour contrib hbtip library with HB_HAS_OPENSSL option for SSL support.