CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2

Thread: EMAIL

  1. #1
    Guest

    EMAIL

    Anybody know any real cool COM objects out there that may be used to for sending/receiving e-mail and providing a neat customizable user interface???
    Thanks



  2. #2
    Join Date
    Jan 2000
    Location
    Olen, Belgium
    Posts
    2,477

    Re: EMAIL

    U can send/receive email with a winsock control
    First set it to TCP/IP (default value) Then set the server and port (110 for receiveing, 25 for sending). Make the connection.

    When that is done:
    for sending:
    you will receiv a message strating with "220" (welcome message)
    send the string "helo hostname" where hostname is your real (or fake) hostname
    when your receive "250 hostname" where hostname is the hostname of the mail server.
    Next thing you do is sending who the mail is from using the "MAIL FROM:<[email protected]>"
    Be sure to include the < and > in the email-address. You will receive "250 OK"
    Then specify who the mail is for: "RCPT TO:<[email protected]>".
    Again, do not forget the < >. This returns "250 OK".
    Then let the host know you are sending the message, send "DATA".
    This returns "354 Start sending mail". Now it is time to send the message header.
    Things you shoul put in your header:
    Return-Path: <email-to-return-mail-to> eg when a user uses reply to author
    Content-type: text/plain OR text/html
    Priority: normal OR urgent OR ASAP or Important OR Bulk
    TO: Cakkie <[email protected]>
    FROM: YOURNAME <YOUR-EMAIL>
    SUBJECT: subject of the email
    Then send an empty line indicating you are sending the message body.
    Then just send the message body. If you are done with that it is time to end.
    Send a string containing a crlf, a point, another crlf.
    You will receive a "250 OK"
    To close the connection, use the "QUIT" command rather than cutting the connection.
    You will receive a "221" and the connection will be closed.

    For receiving
    You will get "+OK pop3 server ready". Send "USER myUserName". Wait until you get a
    "+OK myUserName is a valid mailbox". Now send the password using "PASS password"
    "+OK mailbox ready" should be the reply. Now send "LIST" to retrieve a list of
    available messages. "This should strat with "+OK # messages (## octets)" where # is the
    number of messages and ## the total size in octets(bytes). This will be followed by
    a list of all available messages, each on a new line looking like this:
    "1 12563"
    "2 356650"
    The first number is a numeric identifier of that message, used to retrieve or delete a message.
    The second number is the number of bytes the message contains.
    Then send "RETR number" to retrieve the wanted message. To clean up the mailbox, use the
    "DELE number" command. To end, send the "QUIT" command, receiving a message like
    "+OK mailbox signing of".

    Note: whenever you send a message to the server, let it end with a crlf. If not, the mail server will not respond to your request.

    Tom Cannaerts
    [email protected]

    The best way to escape a problem, is to solve it.
    Tom Cannaerts
    email: [email protected]
    www.tom.be (dutch site)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured