By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,505 Members | 1,034 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,505 IT Pros & Developers. It's quick & easy.

Send email throught VB.NET 2005

P: n/a
April 12, 2006

Hi all

I want to send an email through a VB.Net 2005 application. Can someone show
me some examples:

1. To send an email through the current default email client, Outlook
Express or Microsoft Office Outlook.
2. Can you determine which is the default client in the application.
3. Send an email that does not use any default email client.

Thank you.
Apr 12 '06 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Here is a class doing the job connecting directly to the mailserver,
not by me. Found it somewhere on the web

So this uses no defoult client

* add the System.Web.Dll reference to your .Net
'* project if doing a Windows Application. An
'* ASP.Net app should include this reference.
'* Simply declare an object of type SendMail in code, ie another class
like a form class,
'* set the body and subject properties, then call
'* MailMessage to send the email
Imports System.Web.Mail

Public Class SendMail
Private _Subject As String
Private _Body As String
Private _Attachment As String
Private _Adress As String
Public Property Adress() As String
Get
Return _Adress
End Get
Set(ByVal Value As String)
_Adress = Value
End Set
End Property
Public Property Subject() As String
Get
Return _Subject
End Get
Set(ByVal Value As String)
_Subject = Value
End Set
End Property
Public Property Body() As String
Get
Return _Body
End Get
Set(ByVal Value As String)
_Body = Value
End Set
End Property
Public Property Attachment() As String
Get
Return _Attachment
End Get
Set(ByVal Value As String)
_Attachment = Value
End Set
End Property
Public Sub MailMessage()
Dim objMail As New MailMessage
'Dim attach As New MailAttachment(_Attachment)
SmtpMail.SmtpServer = "000.00.00" 'this needs to be the Smtp
mail server, a proxy will not work, get this from your administrator,
or Exchange server name in outlook
objMail.From = "sender@home"
objMail.To = _Adress
objMail.Subject = _Subject 'Subject text
objMail.Body = _Body 'Body Text
objMail.BodyFormat = MailFormat.Text 'Html 'can be text also
SmtpMail.Send(objMail)
End Sub
End Class

Apr 12 '06 #2

P: n/a
I'm trying to figure out the same. So far, I think these links might
prove helpful:

http://www.c-sharpcorner.com/Interne...hOutlookCB.asp
http://www.systemnetmail.com/default.aspx
http://www.codeproject.com/csharp/simplemapidotnet.asp

Mike TI wrote:
April 12, 2006

Hi all

I want to send an email through a VB.Net 2005 application. Can someone show
me some examples:

1. To send an email through the current default email client, Outlook
Express or Microsoft Office Outlook.
2. Can you determine which is the default client in the application.
3. Send an email that does not use any default email client.

Thank you.

Apr 12 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.