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
email

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>

email[5] ... <CC e-mail addresses>

email[6] ... <BCC e-mail addresses>

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.

Note: The function is a Qt program and uses the cutelyst/simple-mail libraries.
Note: In order to use sendMail(), a reference to communication library needs to be added.

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"
#uses "communication"

main()
{
  string smtp_host = "smtp.gmail.com:587";
  dyn_string email;
  email = makeDynString ("maxMustermann@googlemail.com", "maxMustermann@etm.at", "Test Mail","Hi, this is a Test and a copy of the mail will also be sent to Marie!", "marie.musterfrau@gmail.com");
  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

Communication Functions

Availability

UI, CTRL