470,619 Members | 1,483 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,619 developers. It's quick & easy.

Send email throught VB.NET 2005

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
2 5789
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
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.

Similar topics

4 posts views Thread by jas | last post: by
4 posts views Thread by Colin Kingston | last post: by
1 post views Thread by Nguyen Thanh Danh | last post: by
6 posts views Thread by JIM.H. | last post: by
3 posts views Thread by =?Utf-8?B?SHVnaA==?= | last post: by
4 posts views Thread by Tony M | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.