Skip to content

silgy_email_attach

Jurek Muszyński edited this page Oct 22, 2019 · 4 revisions

bool silgy_email_attach(const char *to, const char *subject, const char *message, const char *att_name, const char *att_data, int att_data_len)

Description

Sends an email using sendmail via pipe. att_name, att_data and att_data_len need to specify the attachement.

Sender is composed in the following way:

sprintf(sender, "%s <%s@%s>", APP_WEBSITE, EMAIL_FROM_USER, APP_DOMAIN);

Default EMAIL_FROM_USER is noreply and can be redefined by APP_EMAIL_FROM_USER.

Returns

TRUE on success, otherwise FALSE.

Example

char msg[1024];

OUTP_BEGIN(msg);
OUTP("Dear %s,\n\n", silgy_usr_name(NULL, NULL, NULL, UID));
OUTP("Thank you for your custom. Please find attached invoice.\n\n");
OUTP("King Regards,\n");
OUTP(APP_WEBSITE);
OUTP_END;

silgy_email_attach(US.email, "Invoice", msg, "invoice.pdf", AUS.invoice_data, AUS.invoice_len);
Clone this wiki locally