Part of Slepp's ProjectsPastebinTURLImagebinFilebin
Feedback -- English French German Japanese
Create Upload Newest Tools Donate
Sign In | Create Account

Unnamed
Monday, August 27th, 2007 at 1:02:45pm MDT 

  1. #define _XOPEN_SOURCE 500
  2.  
  3. #include <stdio.h>
  4. #include <stdlib.h>
  5. #include <ctype.h>
  6. #include <unistd.h>
  7. #include <getopt.h>
  8. #include <string.h>
  9. #include <fcntl.h>
  10. #include <signal.h>
  11. #include <errno.h>
  12. #include <stdarg.h>
  13.  
  14. #include <openssl/ssl.h>
  15. #include <auth-client.h>
  16. #include <libesmtp.h>
  17.  
  18. int main (void)
  19. {
  20.         const char hostport[40] = "mail.mydomain.com:25", mailbox[30] = "he.himself@hisdomains.com";
  21.         char header[200];
  22.         smtp_session_t session;
  23.         smtp_message_t message;
  24.         smtp_recipient_t recipient;
  25.                
  26.         printf("Copying headers...\n");
  27.         strcpy(header, "From: \"Me Myself\"<me.myself@mydomain.com>\nTo: \"He Himself\" <he.himself@hisdomain.com>\n");
  28.        
  29.         printf("Creating SMTP session...\n");
  30.         if((session = smtp_create_session()) == NULL)
  31.         {
  32.                 printf("Failed trying to create smtp session!\nExiting now.\n");
  33.                 exit(1);
  34.         }
  35.        
  36.         printf("Configuring server host and port...\n");
  37.         if(!smtp_set_server(session, hostport))
  38.         {
  39.                 printf("Failed trying to set server host and port!\nExiting now.\n");
  40.                 exit(1);
  41.         }
  42.        
  43. /*      printf("Configuring authentication...\n");
  44.         if(!smtp_auth_set_context(smtp_session_t session, auth_context_t context))
  45.         {
  46.                 printf("Failed setting authentication context!\nExiting now.\n");
  47.                 exit(0);
  48.         }
  49. */
  50.        
  51.         printf("Adding recipient list...\n");
  52.         recipient smtp_add_recipient(message, const char *mailbox);
  53.        
  54.         printf("Adding message headers...\n");
  55.         if(!smtp_set_header(message, header))
  56.         {
  57.                 printf("Failed trying to allocate message!\nExiting now.\n");
  58.                 exit(1);
  59.         }
  60.        
  61.         /* Successfuly terminated */
  62.         return 0;
  63. }

advertising

Update the Post

Either update this post and resubmit it with changes, or make a new post.

You may also comment on this post.

update paste below
details of the post (optional)

Note: Only the paste content is required, though the following information can be useful to others.

Save name / title?

(space separated, optional)



Please note that information posted here will expire by default in one month. If you do not want it to expire, please set the expiry time above. If it is set to expire, web search engines will not be allowed to index it prior to it expiring. Items that are not marked to expire will be indexable by search engines. Be careful with your passwords. All illegal activities will be reported and any information will be handed over to the authorities, so be good.

fantasy-obligation