Thread: sending email

  1. #1
    Registered User
    Join Date
    Apr 2005
    Posts
    98

    sending email

    if i want to send email form my program i need a SMTP library right?
    so do u know of any free libraries for API?

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,660
    Well you need to say which OS and compiler you have if you want a half-decent answer.
    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.

  3. #3
    Registered User
    Join Date
    Apr 2005
    Posts
    98
    windows xp, dev-c++
    isn't it possible to send email with winsock?

  4. #4
    Registered User
    Join Date
    Jun 2005
    Posts
    5
    Yes, read up on the RFC ( http://www.ietf.org/rfc/rfc0821.txt )

  5. #5
    Registered User
    Join Date
    Apr 2005
    Posts
    98
    thanks, it's a nice site =)

    i have a problem:
    i'm sening the server the data in the order specified in the site, and i get the right replys, but when i open the mailbox i sent the message to, there is only a message with no contents nor sender info - it's completely empty.
    the same happens when i send an email with a demo program i've downloaded.
    what's wrong?

  6. #6
    Registered User
    Join Date
    Jun 2005
    Posts
    5
    If it does it with a seperate email client also, then it could be the POP3 (If thats what it uses) thats messed up the other end. Or it could be something to do with your internet connection (firewall?)

  7. #7
    Registered User
    Join Date
    Apr 2005
    Posts
    98
    oops i had a really foolish mistake, in the data i forgot to put "From:" "To:" etc.
    1 last question:
    in all the mail servers, the server name is mail.<what behind the @> ?
    for example:
    [email protected]=> server: mail.aaa.bbb
    Last edited by hiya; 06-26-2005 at 01:50 AM.

  8. #8
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,660
    Get ethereal.
    Watch what happens when your real email client sends mail
    Watch what happens when your code sends mail
    Study the differences in messages.
    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.

  9. #9
    Yes, my avatar is stolen anonytmouse's Avatar
    Join Date
    Dec 2002
    Posts
    2,544
    Quote Originally Posted by hiya
    1 last question:
    in all the mail servers, the server name is mail.<what behind the @> ?
    for example:
    [email protected]=> server: mail.aaa.bbb
    No. If you want to send directly to the destination mail server, you must do a MX lookup for the destination domain. However, you should send mail to the local outgoing mail server of your ISP. Typically, you should ask the user for this server name when setting up an email account. Some ISPs block direct communication with other mail servers because of problems with spam zombies.

  10. #10
    Registered User
    Join Date
    Apr 2005
    Posts
    98
    oh.. ok, thanks.

    btw, what is that MX?

  11. #11
    Registered User
    Join Date
    Mar 2004
    Posts
    161
    it is a MAIL EXCHANGE lookup request
    This forum is the best one I've ever seen. Great ppl, great coders

  12. #12
    Registered User
    Join Date
    Apr 2005
    Posts
    134
    Quote Originally Posted by hiya
    oh.. ok, thanks.

    btw, what is that MX?
    Its the mail exchanger record in the DNS server. Thats how your ISP's SMTP relay server knows about the mail server for any domain. Like for example for a domain like www.yahoo.com, it has its own mail server (infact more than one) to exchange mails for the domain yahoo.com. When your ISPs SMTP relay server receives a mail for yahoo.com domain. It sends a DNS query to its local DNS server which then queries yahoo's DNS server ( there might be some intermediate DNS servers here) who returns the DNS record for the domain yahoo.com. The DNS record contains 'A' records (user to open www.yahoo.com) and 'MX' records used to send mails to the domain yahoo.com

    following is the output of dns query to the domain yahoo.com

    yahoo.com internet address = 216.109.112.135
    yahoo.com internet address = 66.94.234.13
    yahoo.com MX preference = 1, mail exchanger = mx2.mail.yahoo.com
    yahoo.com MX preference = 1, mail exchanger = mx3.mail.yahoo.com
    yahoo.com MX preference = 5, mail exchanger = mx4.mail.yahoo.com
    yahoo.com MX preference = 1, mail exchanger = mx1.mail.yahoo.com
    yahoo.com nameserver = ns1.yahoo.com
    yahoo.com nameserver = ns2.yahoo.com
    yahoo.com nameserver = ns3.yahoo.com
    yahoo.com nameserver = ns4.yahoo.com
    yahoo.com nameserver = ns5.yahoo.com

    yahoo.com nameserver = ns2.yahoo.com
    yahoo.com nameserver = ns3.yahoo.com
    yahoo.com nameserver = ns4.yahoo.com
    yahoo.com nameserver = ns5.yahoo.com
    yahoo.com nameserver = ns1.yahoo.com
    mx2.mail.yahoo.com internet address = 67.28.114.36
    mx2.mail.yahoo.com internet address = 4.79.181.13
    mx2.mail.yahoo.com internet address = 64.156.215.8
    mx2.mail.yahoo.com internet address = 67.28.114.35
    mx3.mail.yahoo.com internet address = 64.156.215.18
    mx3.mail.yahoo.com internet address = 4.79.181.12
    mx3.mail.yahoo.com internet address = 64.156.215.5
    mx3.mail.yahoo.com internet address = 64.156.215.6
    mx4.mail.yahoo.com internet address = 67.28.113.19
    mx4.mail.yahoo.com internet address = 68.142.202.11
    mx4.mail.yahoo.com internet address = 68.142.202.12
    mx4.mail.yahoo.com internet address = 66.218.86.156
    ns1.yahoo.com internet address = 66.218.71.63
    >

    mail exchange records are the mail servers for yahoo.com domain. As you can see there are more than one and they are assigned appropriate preferences.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Spam Filters. ISP based email is dying.
    By Mario F. in forum A Brief History of Cprogramming.com
    Replies: 14
    Last Post: 03-05-2008, 12:05 PM
  2. Sending Email - Using System.Net.Mail
    By b4ip in forum C# Programming
    Replies: 1
    Last Post: 06-01-2007, 12:34 AM
  3. Sending a email using c++
    By Guttih in forum C++ Programming
    Replies: 4
    Last Post: 12-08-2003, 07:00 PM
  4. sending strings from program to email
    By Unregistered in forum C++ Programming
    Replies: 3
    Last Post: 04-09-2002, 06:23 PM
  5. sending email from (C++)exe file through ASP
    By priya in forum C++ Programming
    Replies: 0
    Last Post: 01-18-2002, 10:14 AM