hb_sendmail()
Moderator: Rathinagiri
- Roberto Lopez
- HMG Founder
- Posts: 4004
- Joined: Wed Jul 30, 2008 6:43 pm
hb_sendmail()
Hi All,
Has anyone a working sample of hb_sendmail()?
TIA.
Has anyone a working sample of hb_sendmail()?
TIA.
Regards/Saludos,
Roberto
(Veritas Filia Temporis)
Roberto
(Veritas Filia Temporis)
- Alex Gustow
- Posts: 290
- Joined: Thu Dec 04, 2008 1:05 pm
- Location: Yekaterinburg, Russia
- Contact:
Re: hb_sendmail()
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()?
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()?
Re: hb_sendmail()
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:
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" )
Kind Regards,
Grigory Filatov
"Everything should be made as simple as possible, but no simpler." Albert Einstein
Grigory Filatov
"Everything should be made as simple as possible, but no simpler." Albert Einstein
- Roberto Lopez
- HMG Founder
- Posts: 4004
- Joined: Wed Jul 30, 2008 6:43 pm
Re: hb_sendmail()
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" )
Regards/Saludos,
Roberto
(Veritas Filia Temporis)
Roberto
(Veritas Filia Temporis)
- Roberto Lopez
- HMG Founder
- Posts: 4004
- Joined: Wed Jul 30, 2008 6:43 pm
Re: hb_sendmail()
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()?
My needs are simpler. I'm only need to send a message to a list of recipients.
I'll try with Grigory sample.
I've posted the question, because I receive astrange error message. I guess that I've missed the parameters.
Thanks Again!
Regards/Saludos,
Roberto
(Veritas Filia Temporis)
Roberto
(Veritas Filia Temporis)
- Roberto Lopez
- HMG Founder
- Posts: 4004
- Joined: Wed Jul 30, 2008 6:43 pm
Re: hb_sendmail()
Ok.Roberto Lopez wrote: Thanks!
The problem was I've attempted to activate TLS, since that I'm testing with a gmail account.
When you set TLS to .t., you'll get an error 'operation not supported'.
So, there is no errors, but the operation is unsuccessful. I guess the TLS is mandatory for Google.
Anyway, there is a way to know the error code, to find what exactly is happening?
Regards/Saludos,
Roberto
(Veritas Filia Temporis)
Roberto
(Veritas Filia Temporis)
- Roberto Lopez
- HMG Founder
- Posts: 4004
- Joined: Wed Jul 30, 2008 6:43 pm
Re: hb_sendmail()
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.
Regards/Saludos,
Roberto
(Veritas Filia Temporis)
Roberto
(Veritas Filia Temporis)
- Alex Gustow
- Posts: 290
- Joined: Thu Dec 04, 2008 1:05 pm
- Location: Yekaterinburg, Russia
- Contact:
Re: hb_sendmail()
OK, Roberto, I understood your needs.
Sorry, but I hasn't gmail account and can't help in such situation
Sorry, but I hasn't gmail account and can't help in such situation
Re: hb_sendmail()
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.
AFAIR you will need to recompile the Harbour contrib hbtip library with HB_HAS_OPENSSL option for SSL support.
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.
...
Kind Regards,
Grigory Filatov
"Everything should be made as simple as possible, but no simpler." Albert Einstein
Grigory Filatov
"Everything should be made as simple as possible, but no simpler." Albert Einstein
- Roberto Lopez
- HMG Founder
- Posts: 4004
- Joined: Wed Jul 30, 2008 6:43 pm
Re: hb_sendmail()
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.
I'll try.
Thanks for the info.
Regards/Saludos,
Roberto
(Veritas Filia Temporis)
Roberto
(Veritas Filia Temporis)