Skip to content

npp_email

Jurek Muszyński edited this page Mar 31, 2022 · 3 revisions

bool npp_email(const char *to, const char *subject, const char *message)

Description

Linux

Adds an email to the sendmail's queue (or whatever is the default MTA i.e. Postfix).

Windows

Node++ has a simple SMTP client for Windows which can be enabled with NPP_EMAIL_FROM_WINDOWS. Bear in mind however that it is not equivalent of Linux' MTA (like sendmail or Postfix) which accepts messages to the queue and sends them properly. Instead, it makes a direct connection to the recipient's MX server and tries to transfer the message. It may often block for considerable amount of time (depending on MX server configuration). It is intended for local email servers (which can then forward messages to the final recipients) or tests.

Sender is composed in the following way:

sprintf(sender, "%s <%s@%s>", NPP_EMAIL_FROM_NAME, NPP_EMAIL_FROM_USER, NPP_APP_DOMAIN);

Default NPP_EMAIL_FROM_USER is noreply and default NPP_EMAIL_FROM_NAME is NPP_APP_NAME's value. Both can be redefined in npp_app.h.

Returns

TRUE on success, otherwise FALSE.

Example

npp_email("john@example.com", "Test message", "This is a test message.");
Clone this wiki locally