EMAIL_SMTP_OPEN Function
Syntax
Arguments
- pSocketPointer
A pointer variable that is populated by EMAIL_SMTP_OPEN().
- ModeCharacter
"" = Default, "SSL" = selects for secure email transport.
- TimeoutNumeric
Default = 5000. The number of milliseconds the function will wait to establish the connection before timing out.
- smtp_serverCharacter
The host name of the SMTP server.
- portNumeric
Default = 25. The TCP port used for the connection.
- usernameCharacter
The user's logon.
- passwordCharacter
The user's password.
- modeCharacter
Specify "SSL" to enable SSL on this connection. Specify "TLS" to enable TLS on this connection.
Returns
- Result_FlagLogical
.T. = Login was successful. .F. = Login was not successful.
Description
The EMAIL_SMTP_OPEN() function opens a connection with a SMTP server. This function, along with EMAIL_SMTP_SEND() and EMAIL_SMTP_CLOSE(), will allow you to send email from a computer that does not have an Alpha Anywhere email profile.
Example
dim pm as P
dim ps as P
if (email_smtp_open(ps, "mail.alphasoftware.com", 25, "username", "password")) then
pm.to = "[email protected]"
pm.from = "[email protected]"
pm.subject = "my subject"
pm.message = "this is the message"
pm.attachments =<<%str%
C:\test.zip
C:\dev\test2.zip
%str%
pm.html_message = "This is the message in HTML"
if (email_smtp_send(pm, ps) <> .f.) then
dim msg as C = "Email sent"
TRACE.writeLn(msg,"Email Log")
else
dim msg as C = "Could not send email"
TRACE.writeLn(msg,"Email Log")
end if
else
dim msg as C = "Could not connect to SMTP server"
TRACE.writeLn(msg,"Email Log")
end if
email_smtp_close(ps)See Also