Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Apple Xcode
- #include <stdio.h>
- #include <stdlib.h>
- // unix, linux
- #define SENDMAIL "/usr/sbin/sendmail -t"
- int main (int argc, const char * argv[])
- {
- // send email using comand sendmail
- char *the_to = "To:bla@bla.bla\n";
- //char *the_from = "From:bla@bla.bla\n";
- FILE *the_email;
- if ((the_email = popen(SENDMAIL, "w")))
- {
- // to
- fputs(the_to, the_email);
- // from
- //fputs(the_from, the_email);
- // subject
- fputs("Subject: My Subject!\n\n", the_email);
- // message
- fputs("Hello World!\n", the_email);
- // close
- pclose(the_email);
- }
- else
- {
- puts("erro no envio de email");
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement