Differences

This shows you the differences between two versions of the page.

Link to this comparison view

sdk:scripts:send-mail [2015/05/05 15:04] (current)
Line 1: Line 1:
 +====== SDK Script send-mail.are ======
 +<code c send-mail.are>​
 +/* DESC: This script will send an E-Mail to the specified address.
 + * Copyright (C) 2012 NetModule AG, Switzerland
 + */
 +
 +void usage () {
 +    printf("​usage:​ send-email.are <to> <​subject>​ <​msg>​\n"​);​
 +    exit(1);
 +}
 +
 +if (argc != 4) {
 +    usage();
 +}
 +
 +to = argv[1];
 +subj = argv[2];
 +msg = "";​
 +for (i = 3; i < argc; i++)  {
 +    msg = strcat(msg, " ", argv[i]);
 +}
 +
 +ret = nb_email_send(to,​ subj, msg);
 +if (ret == 0) {
 +    printf("​Successfully sent E-Mail to %s\n", to);
 +} else {
 +    printf("​Unable to send E-Mail\n"​);​
 +}
 +
 +exit(0);
 +
 +</​code>​