Page 1 of 1

any sample with sending mail

PostPosted: Thu Jun 12, 2008 5:38 pm
by kajot
anybody has sample with sending mail ?

PostPosted: Thu Jun 12, 2008 6:16 pm
by James Bott
See FWH\samples\testmail.prg and testsmtp.prg.

testmail.prg uses MAPI and testsmtp uses SMTP.

James

PostPosted: Thu Jun 12, 2008 6:24 pm
by kajot
I test testsmtp, but it does't send my mail.

PostPosted: Thu Jun 12, 2008 6:36 pm
by James Bott
Did you edit it with your own SMTP server? You can't use the fivewin SMTP server. If you don't have an SMTP sever, then you can't use this program. Also, I think some SMTP servers require user authentication in which case this program won't work.

There is a third party TSMTP class that has more features. However lots of people have had trouble using both versions. A lot seems to depend on the SMTP server.

James

PostPosted: Thu Jun 12, 2008 7:39 pm
by kajot
how may I check , if may SMTP server required authorization
my SMTP server: smtp.hot.pl

PostPosted: Thu Jun 12, 2008 7:43 pm
by kajot
what I have to setup if may smtp server required authorizatio

PostPosted: Fri Jun 13, 2008 1:03 am
by James Bott
Kajot,

You can google for blat.exe. This program is a command line program to send email via SMTP. You can try to send email via your server with this to see if it works. If you can get it working with blat.exe, then maybe you can get it working with FWH.

James

PostPosted: Fri Jun 13, 2008 3:40 pm
by Rochinha
Friends

Take look this:

Code: Select all  Expand view
...
   DEFINE BUTTON OF oBar ;
                 ACTION Blat( "Este e o corpo da mensagem",;
                              "smtp.itelefonica.com.br",;
                              "jscrocha@terra.com.br",;
                              "irochinha@itelefonica.com.br",;
                              "Greetings from Joe!",;
                              "Usuario",;
                              "Senha",;
                              "c:\autoexec.bat" ) TOOLTIP "Enviar Mail"
...


The Blat code:
Code: Select all  Expand view
...
function blat( cbody ,;
               cserver ,;
               cMailTo ,;
               cMailFrom ,;
               csubject ,;
               cUserEmail ,;
               cUserPassWord ,;
               cattach )
     BlatCMD := [ blat.txt] + ;
                [ -server ]   + alltrim(cserver) + ;
                [ -to ]       + alltrim(cMailTo) + ;
                [ -f ]        + alltrim(cf) + ;
                [ -mailfrom ] + alltrim(cMailFrom) + ;
                [ -subject "] + alltrim(csubject) + ["] + ;
                [ -r ]        + ;
                [ -u ]        + alltrim(cUserEmail) + ;
                [ -pw ]       + alltrim(cUserPassWord) + ;
                [ -log "email.log" -debug ] + ;
                iif( empty( cAttach ),[],[ -attach "] + alltrim(cattach) + ["])
     cMacro="BLAT.EXE " + BlatCMD
     fErase( "email.log" )
     cBody := FormHtml( cSubject, cBody )
     memowrit( "blat.txt", cbody )
     //memowrit( "blat.bat", cMacro )
     WinExec( cMacro, 0 )
     if file( "email.log" )
        BlatLOG := memoread( "email.log" )
        if "ERROR" $ Upper(BlatLOG)
            Mensagem( "Erro: arquivo de EMAIL.LOG foi criado" )
            return .f.
        endif
     endif
     RETURN .T.
...


Authentication need your SMTP Server and POP user and password.

PostPosted: Sat Jun 14, 2008 5:55 pm
by kajot
what is variable cf ????
and function FormHtml( cSubject, cBody )

PostPosted: Sun Jun 15, 2008 1:19 pm
by RAMESHBABU
>>what is variable cf ????

-cf <file> : cc receipts list filename

- Ramesh Babu P

PostPosted: Mon Jun 16, 2008 2:59 pm
by kajot
cf ??
this is name file whitch I want to send ?

PostPosted: Mon Jun 16, 2008 3:11 pm
by RAMESHBABU
Code: Select all  Expand view
function blat( cbody ,;
               cserver ,;
               cMailTo ,;
               cf,;
               cMailFrom ,;
               csubject ,;
               cUserEmail ,;
               cUserPassWord ,;
               cattach )
     BlatCMD := [ blat.txt] + ;
                [ -server ]   + alltrim(cserver) + ;
                [ -to ]       + alltrim(cMailTo) + ;
                [ -f ]        + alltrim(cf) + ;
                [ -mailfrom ] + alltrim(cMailFrom) + ;
                [ -subject "] + alltrim(csubject) + ["] + ;
                [ -r ]        + ;
                [ -u ]        + alltrim(cUserEmail) + ;
                [ -pw ]       + alltrim(cUserPassWord) + ;
                [ -log "email.log" -debug ] + ;
                iif( empty( cAttach ),[],[ -attach "] + alltrim(cattach) + ["])


You have to include "cf" as fourth parameter in Blat Function (which is missing in the example) and supply the cc receipts list filename as cf.

- Ramesh Babu P

PostPosted: Mon Jun 16, 2008 3:39 pm
by James Bott
Kajot,

>cf ??
>this is name file whitch I want to send ?

No this is the name of a text file containing a list of the addresses of recipients that you want the mail to be CC'd (carbon copied) to.

PostPosted: Mon Jun 16, 2008 5:56 pm
by kajot
do You have any sample ?

PostPosted: Mon Jun 16, 2008 6:04 pm
by James Bott
Kajot,

>do You have any sample ?

It is just a list of email addresses.