sendMail()
The function sendMail() sends e-mails encrypted via the SMTP server.
Synopsis
void sendMail(string smtp_host, dyn_string email, int &
ret, string smtp_user = "", string smtp_pass = "", bool useTLS = FALSE, string
sAttachPath = "");
Parameters
Parameter | Description |
---|---|
smtp_host | Name of the SMTP Server |
The Parameter "email" has to contain the following Information for the e-mail: email[1] ... <destination e-mail address> email[2] ... <source meaning the sender e-mail address> email[3] ... <subject> email[4] ... <body> |
|
ret | Parameter for the errors that occur when sending or receiving e-mails, for example, the e-mail could not be sent or the mailbox is full. |
smtp_user | User name for the SMTP Server. |
smtp_pass | Password for the SMTP Server. |
useTLS | Set to TRUE in order to use encryption and authentication (SSL/TLS). |
sAttachPath | Full path for attachments. |
Return value
- (void)
Errors
Errors during sending and receiving e-mails such as the e-mail could not be sent, the mailbox is full or the connection to the SMTP server could not be established.
Description
The function sendMail() sends e-mails encrypted via the SMTP server.
Sends an e-mail with the subject "Hello" and the body "Hi this is a Test" to the address maxMustermann@googlemail.com.
#uses "std.ctl" main() { string smtp_host = "smtp.gmail.com:587"; dyn_string email; email= makeDynString ("maxMustermann@googlemail.com", "maxMustermann@etm.at", "Hello","Hi this is a Test"); int ret; string smtp_user = "maxMustermann@googlemail.com"; string smtp_pass = "myPassword"; bool useTLS = TRUE; string sAttachPath = "D:\\Downloads\\Image1.png"; sendMail(smtp_host,email, ret,smtp_user,smtp_pass, useTLS,sAttachPath ); }
Assignment
Availability
UI, CTRL