Results 1 to 14 of 14

Thread: Email Client

  1. #1

    Thread Starter
    Lively Member crazy1993's Avatar
    Join Date
    Sep 2010
    Location
    Rochester, NY
    Posts
    85

    Question Email Client

    Hey everyone,

    I'm trying to make a email client but my biggest problem is finding a component that is (preferably) free. I need one that works with IMAP and POP3. Also would be nice if it could handle sending emails (Via SMTP). It would also be great if it worked with gmail.

    Can anyone give any suggestions?

    Thanks in advanced

    Peace
    ~Dustin Schreiber
    Head Developer for TechJive Dev Team - Founder of http://www.thetechsphere.com
    Who *cares* if a laser guided 500 lb bomb is accurate to within 9 feet?
    Teamwork is essential. It gives the enemy someone else to shoot at.
    Retreating?! Hell no, we're just attacking the other direction!

    Please rate posts if you find them helpful
    <--- Over there genius

  2. #2
    Member
    Join Date
    Aug 2009
    Posts
    43

    Re: Email Client

    I will be at my house in about 2-3 hours and I will give you my source code for my emailer.

  3. #3
    Pro Grammar chris128's Avatar
    Join Date
    Jun 2007
    Location
    England
    Posts
    7,604

    Re: Email Client

    Not sure if it helps but I started writing a .NET SMTP library a while ago - got it working but never really finished it. You can find more info and a BETA version of the DLL I made on my blog here: http://en.wordpress.com/tag/cjwdev-mail/
    There's also this: http://sourceforge.net/projects/mail-net/
    My free .NET Windows API library (Version 2.2 Released 12/06/2011)

    Blog: cjwdev.wordpress.com
    Web: www.cjwdev.co.uk


  4. #4

    Thread Starter
    Lively Member crazy1993's Avatar
    Join Date
    Sep 2010
    Location
    Rochester, NY
    Posts
    85

    Re: Email Client

    Thanks chris128. I'll check it out.

    Hunterwould: Take ur time. And THanks
    ~Dustin Schreiber
    Head Developer for TechJive Dev Team - Founder of http://www.thetechsphere.com
    Who *cares* if a laser guided 500 lb bomb is accurate to within 9 feet?
    Teamwork is essential. It gives the enemy someone else to shoot at.
    Retreating?! Hell no, we're just attacking the other direction!

    Please rate posts if you find them helpful
    <--- Over there genius

  5. #5

    Thread Starter
    Lively Member crazy1993's Avatar
    Join Date
    Sep 2010
    Location
    Rochester, NY
    Posts
    85

    Re: Email Client

    @Chris128 - I was reading your blog and I saw that you mentioned it doesn't need to have a SMTP server? I havn't quite figured out how that works yet. If i have a client setup and i use my gmail address will it send as me from my gmail address? And will a copy show up in gmail? FYI To all: I am the head developer for TechJive Software and I am working on the next release of OfficeMonkey and we've been trying to incorperate emailing. If we do use your SMTP library, 1) Is that okay with you? 2) Do you want your name and site in the about dialog box and/or on the website?
    ~Dustin Schreiber
    Head Developer for TechJive Dev Team - Founder of http://www.thetechsphere.com
    Who *cares* if a laser guided 500 lb bomb is accurate to within 9 feet?
    Teamwork is essential. It gives the enemy someone else to shoot at.
    Retreating?! Hell no, we're just attacking the other direction!

    Please rate posts if you find them helpful
    <--- Over there genius

  6. #6
    Pro Grammar chris128's Avatar
    Join Date
    Jun 2007
    Location
    England
    Posts
    7,604

    Re: Email Client

    Well I wouldn't recommend actually using my SMTP library because as I said it is not really finished and although I did get it to successfully send any emails I tested with, some other people that tested it did report some bugs. I was offering it to you more for you to have a look and see if you wanted a copy of the source code to learn from and/or build upon.

    As for SMTP server side of it - I think I already explained fairly well on my blog but I'll try explain again here in more detail. Let's look at the process of sending an email (not using my library specifically, just sending an email in general):
    First of all you use some email client like Microsoft Outlook or a web page like gmail to create your email, then you click Send. Now what happens behind the scenes is that your message gets submitted to an SMTP server, usually it is one on your own network if you are on a business network but in the case of gmail it would be submitted to one of gmail's internal SMTP servers. Note that you can submit an email to any SMTP server (assuming you have any passwords that may be required, but internal SMTP servers on business networks rarely require passwords), it does not have to be an SMTP server that is also responsible for receiving emails for the domain you are sending your email from. For example I could submit an email to an SMTP server running on my home PC and specify that the From address is [email protected] even though I do not own test.com or have anything to do with it. This brings me on to my next point - a simple email is just a load of plain text headers followed by the body of the email. There is absolutely nothing stopping you from creating an email that pretends to be from any address you want, its just that email clients like Outlook and gmail etc don't give you an option to do this. Having said that, a lot of spam filters now will check to see if an email was originally sent from an IP address that matches the MX record for the domain the email says it is from.

    Which leads nicely on to the next part: MX Records.

    I mentioned that your email gets submitted to an SMTP server when you hit Send, but how does that SMTP server then know where to send it? A computer can't actually send data to an email address, it can only send data to an IP address, so the SMTP server needs some way of getting the external IP address of the email server that handles emails for the domain you are sending your email to (the actual recipient doesn't matter at this point, it is only the domain, i.e everything after the @ symbol that is used in this part of the process). That is where MX records come in, and this is why it took me so long to write my SMTP library, because .NET has no way built in for doing MX lookups. An MX lookup is the process that an SMTP server uses to find the IP address of the email server for a particular domain. Basically the SMTP server issues a DNS query to whatever DNS server it is set to use, asking for the MX records for domain XXXX and the DNS server will return a list of host names that are listed as being responsible for email delivery for that domain (e.g mail.microsoft.com) along with a priority - these are the MX records. The SMTP server can then issue another DNS query to get the IP address for the MX record with the highest priority first, and then it can try to transfer the email message you submitted to that IP address. If no connection can be established via TCP port 25 (the standard SMTP port) to this IP address then it will move on to the MX record with the next highest priority, until a connection is successfully established. If none of the MX records point to servers that are actually accepting SMTP traffic then the SMTP server will give up and return a Non Delivery Report to the sender of the email explaining the error.

    So lets assume one of the connection attempts was successful. Once a connection on port 25 has been established, the SMTP server sends a series of standard SMTP commands to actually transfer the email. This sequence of commands usually goes like this, and you can actually do this yourself manually by using telnet to connect to an SMTP server on port 25 and typing the commands (assuming the server you connect to does not require a password):
    EHLO
    MAIL FROM: [email protected]
    RCPT TO: [email protected]
    DATA
    Subject: This is the subject
    Hello, this is the email body
    .

    That full stop on a line on its own at the end is what tells the receiving server that you have finished submitting the email and assuming the receiving server does not return an error code at that point, it then becomes the responsibility of that server to deliver the email. The sending server now has no control or visibility of the email and must just assume that it has been delivered successfully. This is why when people send an email they shouldn't have and then ask "is there any way I can cancel it or get it returned" the answer is always no (unless it was only sent internally within the same email system). Note that in the example above, "Subject:" is not an SMTP command, it is actually part of the message (everything after the DATA command is the actual email itself). It is a header - the only things actually required to submit an email are sender and recipient, all of the other information you get like the subject, sent date/time, sender display name (ie "John Smith"), etc etc are all just headers added to the start of the email. When you send an email through a proper email server tons of email headers get added to it, and you can view the raw headers in most email clients, its just not usually obvious how to do so as most people won't ever need to. Can be useful for troubleshooting though as most messages will have a lot of information in the headers such as the host name and IP of the original SMTP server that sent the message.

    So now that you can see how an email is sent, you hopefully can understand how my library cuts out the need for an SMTP server... because my library basically is doing exactly what an SMTP server would do. It does all of that same work: the MX lookup, trying to connect on port 25 to each MX record (if the previous one was unsuccessful anyway), submitting the commands, checking for errors returned etc etc.


    Now the caveats of this approach are as follows:
    SMTP servers are generally more trusted than your standard PC, both on a business network and in the public internet. For example if you try to submit an email directly from your home PC to an address at a public email service like hotmail or gmail, it will often get rejected purely because the receiving server realises you are on a home broadband connection rather than a 'more trusted' business network.
    Also, if you have a firewall that is set to block port 25 outbound from your PC (which a lot of businesses do to prevent mass email viruses from sending from them) then this option is a no go. You might think well how does Outlook send emails then in a business network? Well it doesn't use SMTP if it is connected to an internal mail server (ie Exchange server), it uses MAPI to talk to the internal exchange server and that server then does the SMTP server work.
    Last edited by chris128; Jan 25th, 2011 at 06:26 PM.
    My free .NET Windows API library (Version 2.2 Released 12/06/2011)

    Blog: cjwdev.wordpress.com
    Web: www.cjwdev.co.uk


  7. #7
    Member
    Join Date
    Aug 2009
    Posts
    43

    Re: Email Client

    There we go it is a pretty simple tool, also comes with spamming feature, very funny to do to friends but gmail will throttle you.

    [Attachment removed by MartinLiss]
    Last edited by MartinLiss; Jan 27th, 2011 at 05:54 PM.

  8. #8

    Re: Email Client

    Quote Originally Posted by Hunterwould View Post
    There we go it is a pretty simple tool, also comes with spamming feature, very funny to do to friends but gmail will throttle you.
    Spamming feature? Not a good thing.

  9. #9

    Thread Starter
    Lively Member crazy1993's Avatar
    Join Date
    Sep 2010
    Location
    Rochester, NY
    Posts
    85

    Re: Email Client

    Quote Originally Posted by formlesstree4 View Post
    Spamming feature? Not a good thing.
    Depends on who's using it lol and why

    Hunterwould: Thanks for that! I am not on my laptop so i can't open the project so i ran the exe, so far i havn't received the email? Possible it hasn't gone thrrough yet though, or i typed it wrong lol, Something weird... If i tell it to send it to myself i get "Not Responding"? I am not sure whats that about, may be something i can fix when i run it from debugger. I'll let you know. Thanks again

    EDIT AGAIN:
    I thinik it was the way i typed it because i received the email i sent to myself this time, but i think it was the way i filled out the textboxes. But it worked this time - Thanks later i will be back on my computer so i'll be able to look at the code more. Thanks again
    Last edited by crazy1993; Jan 25th, 2011 at 09:30 PM. Reason: Merge
    ~Dustin Schreiber
    Head Developer for TechJive Dev Team - Founder of http://www.thetechsphere.com
    Who *cares* if a laser guided 500 lb bomb is accurate to within 9 feet?
    Teamwork is essential. It gives the enemy someone else to shoot at.
    Retreating?! Hell no, we're just attacking the other direction!

    Please rate posts if you find them helpful
    <--- Over there genius

  10. #10

    Thread Starter
    Lively Member crazy1993's Avatar
    Join Date
    Sep 2010
    Location
    Rochester, NY
    Posts
    85

    Re: Email Client

    @Hunterwould: I just tried implementing your method into a form, mainly so i know how to do it, it worked perfectly! I like the spinner you added to show its sending. I think i will use your method for sending mail (at least for now) One question, i noticed a DLL was imported, do i need that?

    One half of the problem down, only one half to go!

    Does anyone know anything about downloading messages using IMAP? Or does anyone know a good component i should look into getting? I know there are so many out there but not sure what one to go with really.

    Again, thanks everyone for your help. Chris128: I didn't forget about you, i want to look at your method more closely.
    ~Dustin Schreiber
    Head Developer for TechJive Dev Team - Founder of http://www.thetechsphere.com
    Who *cares* if a laser guided 500 lb bomb is accurate to within 9 feet?
    Teamwork is essential. It gives the enemy someone else to shoot at.
    Retreating?! Hell no, we're just attacking the other direction!

    Please rate posts if you find them helpful
    <--- Over there genius

  11. #11
    Pro Grammar chris128's Avatar
    Join Date
    Jun 2007
    Location
    England
    Posts
    7,604

    Re: Email Client

    Quote Originally Posted by crazy1993 View Post
    Chris128: I didn't forget about you
    awww thanks
    My free .NET Windows API library (Version 2.2 Released 12/06/2011)

    Blog: cjwdev.wordpress.com
    Web: www.cjwdev.co.uk


  12. #12

    Thread Starter
    Lively Member crazy1993's Avatar
    Join Date
    Sep 2010
    Location
    Rochester, NY
    Posts
    85

    Re: Email Client

    Anybody? Anything? Question is: IMAP control, works well and is easy to use, preferably free,?
    ~Dustin Schreiber
    Head Developer for TechJive Dev Team - Founder of http://www.thetechsphere.com
    Who *cares* if a laser guided 500 lb bomb is accurate to within 9 feet?
    Teamwork is essential. It gives the enemy someone else to shoot at.
    Retreating?! Hell no, we're just attacking the other direction!

    Please rate posts if you find them helpful
    <--- Over there genius

  13. #13
    Member
    Join Date
    Aug 2009
    Posts
    43

    Re: Email Client

    oh the imported dll is the progress bar, it is not needed if you do not wish to have a vertical progress bar.

  14. #14

    Thread Starter
    Lively Member crazy1993's Avatar
    Join Date
    Sep 2010
    Location
    Rochester, NY
    Posts
    85

    Re: Email Client

    Quote Originally Posted by Hunterwould View Post
    oh the imported dll is the progress bar, it is not needed if you do not wish to have a vertical progress bar.
    Thanks
    ~Dustin Schreiber
    Head Developer for TechJive Dev Team - Founder of http://www.thetechsphere.com
    Who *cares* if a laser guided 500 lb bomb is accurate to within 9 feet?
    Teamwork is essential. It gives the enemy someone else to shoot at.
    Retreating?! Hell no, we're just attacking the other direction!

    Please rate posts if you find them helpful
    <--- Over there genius

Tags for this Thread

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