Deixa eu puxar a sardinha... hehehe
O PageScript 4 tem uma função para envio de e-mails, a PSSendmail.
Segue abaixo a sintaxe da mesma:
PSSendMail()
--------------------------------------------------------------------------------
Syntax
PSSendMail(<aHost>, <aMessage>)
Returns
An array of two elements. The first element is true if any error occured during the call to PSSendMail, otherwise, false is returned. The second element contains a character string with the message returned by the call to PSSendMail().
Description
Use PSSendMail() to send simple eMails (subject and body), in text only format. The functions requires two parameters. The first one is an array of 5 elements containing the HOST part and the second parameter is an array of 5 elements containing the MESSAGE part. These array elements are defined in PSMail.ch, which is described below.
Arguments
<aHost> Array containing the host structure.
<aMessage> Array containing the message structure.
PSMail.ch, array definition
Constant Example Type Description
Host array
APH_HOST "smtp.myhost.net" Char This is the host smtp address
APH_PORT 25 Num smtp Port number. Normaly 25. Defaults to 25.
APH_USERNAME "myusername" Char Your username to access the host smtp server
APH_PASSWORD "mypassword" Char Your password to access the host smtp server, if required.
APH_MAILAGENT "PSMailer" Char The name of the mail agent. Defaults to PSMailer.
Message array
APM_FROMMAIL {"
martinrw@myserver.com", "Richard W Martin"} Array of Char A two elements array. The first element of the array is your email address and the second array element is your full name. The second element may be an empty string.
APM_TOMAIL {"
mrecipient@server.net", "Mr. recipient"} Array of Char A two elements array. The first element of the array is the email address of the recipient and the second array element is the full name. The second element may be an empty string.
APM_SUBJECT "PageScript" Char The subject or the message. May not be empty.
APM_BODY "Dear sir," + CRLF2 + "Let me tell you about..." Char The body part of the message. May contain only characters and CR/LF, no control characters.
APM_PRIORITY 5 Num Priority of the message. Defaults to normal priority (3 - APP_NORMAL).
Priority constants
APP_HIGHEST n/a Num Highest priority.
APP_HIGH n/a Num High priority.
APP_NORMAL n/a Num Normal priority (default for APM_PRIORITY).
APP_LOW n/a Num Low priority.
APP_LOWEST n/a Num Lowest priority.
Example
#include "PSMail.ch"
Local aHost[APH_TOTAL]
Local aMessage[APM_TOTAL]
Local aReturn
aHost[APH_HOST] := "smtp.myserver.net"
aHost[APH_PORT] := 21 // Not required
aHost[APH_USERNAME] := "myusername"
aHost[APH_PASSWORD] := "" // Not required
aHost[APH_MAILAGENT] := "" // Not required
aMessage[APM_FROMMAIL] := {"
rm@myserver.net, "Richard W Martin"}
aMessage[APM_TOMAIL] := {"
you@yourserver.com", "You Yourself"}
aMessage[APM_SUBJECT] := "PageScript 4"
aMessage[APM_BODY] := "Let me tell you why PageScript is so wonderful..."
aMessage[APM_PRIORITY] := APP_NORMAL // Not required
aReturn := PSSendMail(aHost, aMessage)
if aReturn[1]
Alert(aReturn[2])
endif
Um Clip Abraço