Marinas Harbour Tools

  • Increase font size
  • Default font size
  • Decrease font size

Harbour Mail Sample ( tip library )

E-mail Print PDF

Mail Sample code Using  HBTIP Library

 

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#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 := " This e-mail address is being protected from spambots. You need JavaScript enabled to view it " // Required. Email address of the sender
local xTo := " This e-mail address is being protected from spambots. You need JavaScript enabled to view it " // 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 := " This e-mail address is being protected from spambots. You need JavaScript enabled to view it " // 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
Last Updated on Monday, 14 March 2011 23:05  

Links

 


 

Statistics

Members : 1
Content : 11
Web Links : 1
Content View Hits : 47829