Thread: C e-mailing

  1. #1
    Registered User Tigers!'s Avatar
    Join Date
    Jun 2009
    Location
    Melbourne, Australia
    Posts
    49

    C e-mailing

    Am I correct in assuming/guessing that there is no native e-mail function within C?

    My work has its own win mail server. Can a C program be used to make use of that existing mail server e.g. send the message to the server and let the server take care of the sending?

    Does anyone know of any code or place where I begin this task?

  2. #2
    Woof, woof! zacs7's Avatar
    Join Date
    Mar 2007
    Location
    Australia
    Posts
    3,459
    Yes you are correct in assuming that, it has no place in standard C.

    The easiest way is to probably use use a SMTP library, or a library that supports whatever mail protocol your server is running.

    I know of no such libraries off the top of my head, so you'll need to search around.

  3. #3
    Registered User Tigers!'s Avatar
    Join Date
    Jun 2009
    Location
    Melbourne, Australia
    Posts
    49
    Further searching google threw up an smtp.h.
    Is anyone familiar with this include file?

    Is it a standard C implementation?

  4. #4
    and the hat of sweating
    Join Date
    Aug 2007
    Location
    Toronto, ON
    Posts
    3,545
    Well without posting your smtp.h file, it would be impossible to know if anyone has seen it before.
    C doesn't know how to do anything useful other than read/write to files, stdin, stdout, stderr... To do anything beyond that, you'll need to use OS API functions (or a library that does it for you). So in that respect, smtp.h couldn't possibly use only standard C functions to send E-mail.
    "I am probably the laziest programmer on the planet, a fact with which anyone who has ever seen my code will agree." - esbo, 11/15/2008

    "the internet is a scary place to be thats why i dont use it much." - billet, 03/17/2010

  5. #5
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,661
    You read Beej to figure out the basics of network programming.
    Beej's Guide to Network Programming

    You read RFC 821 to figure out the basics of talking "SMTP" to an email server
    http://www.ietf.org/rfc/rfc0821.txt

    Open a port, send some commands, get some replies, job done.


    Or find a library (for your unstated OS/Compiler) which does some of the work for you.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Know any mailing list program?
    By alphaoide in forum Tech Board
    Replies: 5
    Last Post: 01-28-2005, 10:26 AM
  2. Mailing Lists
    By damonbrinkley in forum C Programming
    Replies: 3
    Last Post: 05-05-2003, 08:47 AM
  3. CGI Mailing
    By sean in forum A Brief History of Cprogramming.com
    Replies: 2
    Last Post: 04-14-2003, 09:56 PM
  4. E mailing
    By OLLand in forum C Programming
    Replies: 1
    Last Post: 12-11-2001, 09:49 AM
  5. Mailing List - Linked List
    By Unregistered in forum C Programming
    Replies: 0
    Last Post: 09-11-2001, 10:04 PM