Hi Professionals,

I am currently working on a mass emailing system. I am using Microsoft Visual Studio 2005. With windows IIS in Windows XP SP3. My program can send mass emails using System.Net.Mail namespace found in .NET 2.0 but i have no idea on how to implement the receiving emails part.

Any advice, links, hints, tips, etc would be greatly appreciated.

Please accept my gratitude in advance.

Best Regards,
Md Azmil

Common way to receive email is a POP3 server. .NET doesn't provide a built-in POP3 server so you'll have to write one of your own or get a third-party POP3 server. To get you started, try googling http://www.google.com/search?q=vb.net+pop3+server.

HTH

P.s. I hope I don't help to build yet another spamming site ;)

Are you trying to write a mailserver from the ground up to listen on port 25 and accept inbound mail messages from remote MTAs, or are you wanting to use a POP3/IMAP/Exchange connection to download your email from your mailserver?

Are you trying to write a mailserver from the ground up to listen on port 25 and accept inbound mail messages from remote MTAs, or are you wanting to use a POP3/IMAP/Exchange connection to download your email from your mailserver?

I am not sure if either one is the one I want. But what I sure of is I'm working on a mass email system for my school project. I am using Microsot Visual Studio 2005, IIS and Microsoft SQL Server 2005. I am also using vb.net as my language and doing it in windows form.

I am able to send email using the System.Net.Mail namespace. But i am not sure what to use to program my system to display and receive emails.

Please advice.

I think you have a fundamental misconception of how email works. Just because you sent an email doesn't mean you have to listen for it. Spammers send email all the time from fictitious addresses and never listen for responses.

In order to send email you need to do one of two things:
1) Create your own mailserver listening on port :25 for inbound email.
2) Connection to an existing mailserver (Your school's, ISPS, etc)

Everything falls under one of those two options

Just because you sent an email doesn't mean you have to listen for it. Spammers send email all the time from fictitious addresses and never listen for responses.

In order to send email you need to do one of two things:
1) Create your own mailserver listening on port :25 for inbound email.

Firstly, I agree on the "Just because you sent an email doesn't mean you have to listen for it" but my project requires me to capture received emails. Secondly, I am not a spammer. And third, can the first option "1) Create your own mailserver listening on port :25 for inbound email." be used to capture receive emails?

Yes it can but you're probably looking at a few months worth of development to get your first version of a mailserver live. I would highly suggest using an existing mailserver and querying it for messages with POP3/Image/Exchange.

Yes it can but you're probably looking at a few months worth of development to get your first version of a mailserver live. I would highly suggest using an existing mailserver and querying it for messages with POP3/Image/Exchange.

Is the mail server free?

That depends on what mailserver you decide to use....

That depends on what mailserver you decide to use....

Ok. But is there any open source(free) or windows XP integrated mailserver that i can use?

Please advise.

Ok. But is there any open source(free) or windows XP integrated mailserver that i can use?

Please advise.

You should be able to simply tap into any mailserver with your username and password.

do some research on the System.Net.Mail namespace.

I believe you could even use something like hotmail or Gmail , though i'm not sure.

You should be able to simply tap into any mailserver with your username and password.

I'm sorry but my username and password of what?

I'm sorry but my username and password of what?

Your username and password the the mailserver, aka your account.

Can you post the code of how you sent the email? If you sent it, you should have specified the mailserver you used, unless your using a method I am unaware of.

Your username and password the the mailserver, aka your account.

Can you post the code of how you sent the email? If you sent it, you should have specified the mailserver you used, unless your using a method I am unaware of.

Sure. Below are codes for sending email:-

Imports System
Imports System.Net.Mail

Public Class Email

Private mailMessage As New Net.Mail.MailMessage()
Dim attachment As Net.Mail.Attachment

Public Sub SendMassEmail(ByVal MsgFrom As String, ByVal MsgTo As String, ByVal MsgSubject As String, ByVal MsgBody As String)

        'This procedure takes string array parameters for multiple recipients and files
        Try

            '  Pass in the message information to a new MailMessage
            mailMessage = New Net.Mail.MailMessage(MsgFrom, MsgTo, MsgSubject, MsgBody)


            '   Adding attachments
            Dim attachment As Net.Mail.Attachment = New Net.Mail.Attachment(ofdAttach.FileName)
            mailMessage.Attachments.Add(New Attachment(txtAttach.Text))

            '   Create an SmtpClient to send the e-mail
            Dim mailClient As New SmtpClient("152.226.152.152")  '  = local machine IP Address


            '  Use the Windows credentials of the current User
            mailClient.UseDefaultCredentials = True


            ' Pass the message to the mail server
            mailClient.Send(mailMessage)


            '  Optional user reassurance:
            MessageBox.Show(String.Format("Message Successfully Sent!" & vbCrLf & vbCrLf & "Message Subject:   {0}" & vbCrLf & "FROM:    {1}" & vbCrLf & "TO:   {2}", MsgSubject, MsgFrom, MsgTo), "EMail", Windows.Forms.MessageBoxButtons.OK, Windows.Forms.MessageBoxIcon.Information)


            '  Housekeeping
            mailMessage.Dispose()


            'Error Checking
        Catch ex As FormatException

            MessageBox.Show(ex.Message & " :Format Exception")

        Catch ex As SmtpException

            MessageBox.Show(ex.Message & " :SMTP Exception")

        End Try

    End Sub

Private Sub btnSend_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSend.Click

SendMassEmail(txtFrom.Text, rtbTo.Text, txtSubj.Text, txtMsg.Text)

    End Sub

End Class

Alright, I did some research and decide to use POP3 to retrieve email and already used SMTP to send email. Can you please give me a headstart with regards to using POP3 in vb.net(Microsoft Visual Studio 2005)?

Thank you.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.