Click here to Skip to main content
15,076,991 members
Please Sign up or sign in to vote.
4.00/5 (2 votes)
See more:
Hi everyone ;
I want to make a window application like outlook in which I can compose new
email and sent it to other mail server like gmail,yahoo,hotmail etc. and also
receive new mail on my inbox folder that are sent from other mail server and one draft folder,sent item etc
i have been done compose new mail and send it. but problem is to receive new mail from other resources like gmail,yahoo,hotmail, etc
and then display in my inbox.please help me how can i do this

below is the code of sent email using smtp..

thanks in advance.
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Net.Mail;
using System.Web;

namespace WindowsFormsApplication1
   public partial class Compose : Form
      public Compose()

      private void btnsend_Click(object sender, EventArgs e)
            MailMessage mail = new MailMessage(txtfrom.Text,txtto.Text,richtxtbody.Text,txtsubject.Text);
            mail.From =new MailAddress(txtfrom.Text.ToString());
            mail.To.Add(new MailAddress(""));
            mail.Attachments.Add(new Attachment(txtattach.Text));
            SmtpClient client = new SmtpClient(txtserver.Text);
            client.Port = 587;
            client.Credentials = new System.Net.NetworkCredential(txtusername.Text, txtpassword.Text);
            client.EnableSsl = true;
            // MessageBox.Show("Sent Successfully!");
            lblmsg.Text = "Your mail Sent Successfully!";
         catch (Exception ex)
            throw ex;
      private void btnattach_Click(object sender, EventArgs e)
         OpenFileDialog opd = new OpenFileDialog();
         //opd.Filter = "JPF files(*.jpg)|*.jpg PNG Files(*.png)|*.png| All Files(*.*)|*.*";
         if (opd.ShowDialog() == DialogResult.OK)
            string filePath=opd.FileName.ToString();
            txtattach.Text = filePath;
Updated 9-Mar-14 8:06am

POP or IMAP. You can try this library:
You need to create a POP client to read emails (Google will find you details on the POP RFC). And you need to get the setup details from each email provider for receiving messages.
Marcin Kozub 9-Mar-14 17:22pm
POP or IMAP. You can try this library:
Richard MacCutchan 10-Mar-14 4:14am
Why are you telling me?
Marcin Kozub 10-Mar-14 4:15am
Sorry ;)
I guess you're looking for :
Read Gmail Inbox Message in ASP.NET[^]


This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900