Here testmail.prg for testing  the hbtip hb_SendMail function... hope
can help some testing user...

Thank you


-- testmail.prg start -------------------------------------------------

#include "common.ch"
#include "simpleio.ch"

// Compile with command: hbmk2 testmail.prg -lhbtip -rebuild

procedure main

    local cServer       :=      "192.168.1.18"                  // Required. IP 
or domain name
of the mail server
    local nPort         :=      25                              // Optional. 
Port used my email server
    local cFrom         :=      "usern...@maildomain.com"       // Required. 
Email
address of the sender
    local xTo           :=      "usern...@maildomain.com"       // Required. 
Character
string or array of email addresses to send the email to
    local xCC           :=      ""                              // Optional. 
Character string or array of
email adresses for CC (Carbon Copy)
    local xBCC          :=      ""                              // Optional. 
Character string or array of
email adresses for BCC (Blind Carbon Copy)
    local cBody         :=      "Please ignore only a test..."  // Optional.
The body message of the email as text, or the filename of the HTML
message to send.
    local cSubject      :=      "Test from Harbour"             // Optional. 
Subject of the
sending email
    local aFiles        :=      {}                              // Optional. 
Array of files attachments to
the email to send {{"a"},{"b"}}
    local cUser         :=      "pop3username"                  // Required. 
User name for the
POP3 server
    local cPass         :=      "pop3userpassword"              // Required. 
User password
for the POP3 server
    local cPopServer    :=      "192.168.1.18"                  // Required. 
POP3 server
name or address
    local nPriority     :=      3                               // Optional. 
Email priority: 1=High,
3=Normal (Standard), 5=Low
    local lRead         :=      .f.                             // Optional. If 
set to .T., a confirmation
request is send. Standard setting is .F.
    local bTrace        :=      .f.                             // 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.
    local lPopAuth      :=      .f.                             // Optional. Do 
POP3 authentication
before sending mail.
    local lNoAuth       :=      .t.                             // Optional. 
Disable Autentication methods
    local nTimeOut      :=      1000                            // Optional. 
Number os ms to wait
default 20000 (20s)
    local cReplyTo      :=      "usern...@maildomain.com"       // Optional. 
mail
address to reply to
    local lTLS          :=      .F.                             // Optional. 
Set to .t. if you want/need to
use Transport Layer Security default to .F.
    local cSMTPPass     :=      ""                              // Optional. 
Character string password
for SMTP server if needed
    local cCharset      :=      ""                              // Character 
set to be used, default
to "ISO-8859-1"
    local cEncoding     :=      ""                              // Optional. 
Encode option to be
used, default to "quoted-printable"

  ? "Sending mail..."
   if  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 )
        ? "An email was sent..."
    else
       alert("Cannot contact the mail server ","Please verify
parameter or the connection...")
   endif

return

-- testmail.prg end -------------------------------------------------
_______________________________________________
Harbour mailing list (attachment size limit: 40KB)
Harbour@harbour-project.org
http://lists.harbour-project.org/mailman/listinfo/harbour

Reply via email to