SDK Script send-mail.are

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);