473,396 Members | 2,057 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Problem in Senting E-Mail using the SmtpMail

Hi !

I wrote one code for Send the E-mail, But that code have some problem , So please help me

Here i paste my code and Error:
Error:
Server Error in '/Elan_Sample' Application.
--------------------------------------------------------------------------------

The transport failed to connect to the server.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Runtime.InteropServices.COMException: The transport failed to connect to the server.

Source Error:
Line 36: Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Line 37: SmtpMail.SmtpServer = "trainee2.com" ' Trainee2.com is my SMTP Name
Line 38: SmtpMail.Send(txtFrom.Text, txtTo.Text, txtSubject.Text, txtBody.Text)
Line 39: End Sub
Line 40: End Class

Source File: C:\Project Files\Root\Elan_Sample\Email Server.aspx.vb Line: 38

Stack Trace:
[COMException (0x80040213): The transport failed to connect to the server.
]

[TargetInvocationException: Exception has been thrown by the target of an invocation.]
System.RuntimeType.InvokeDispMethod(String name, BindingFlags invokeAttr, Object target, Object[] args, Boolean[] byrefModifiers, Int32 culture, String[] namedParameters) +0
System.RuntimeType.InvokeMember(String name, BindingFlags invokeAttr, Binder binder, Object target, Object[] args, ParameterModifier[] modifiers, CultureInfo culture, String[] namedParameters) +473
System.Web.Mail.LateBoundAccessHelper.CallMethod(O bject obj, String methodName, Object[] args) +58

[HttpException (0x80004005): Could not access 'CDO.Message' object.]
System.Web.Mail.LateBoundAccessHelper.CallMethod(O bject obj, String methodName, Object[] args) +112
System.Web.Mail.CdoSysHelper.Send(MailMessage message) +1840
System.Web.Mail.CdoSysHelper.Send(String from, String to, String subject, String messageText) +74
System.Web.Mail.SmtpMail.Send(String from, String to, String subject, String messageText) +171
Elan_Sample.Email_Server.Button1_Click(Object sender, EventArgs e) in C:\Project Files\Root\Elan_Sample\Email Server.aspx.vb:38
System.Web.UI.WebControls.Button.OnClick(EventArgs e) +108
System.Web.UI.WebControls.Button.System.Web.UI.IPo stBackEventHandler.RaisePostBackEvent(String eventArgument) +57
System.Web.UI.Page.RaisePostBackEvent(IPostBackEve ntHandler sourceControl, String eventArgument) +18
System.Web.UI.Page.RaisePostBackEvent(NameValueCol lection postData) +33
System.Web.UI.Page.ProcessRequestMain() +1277




ASP.NET Script :

<%@ Page Language="vb" AutoEventWireup="false" Codebehind="Email Server.aspx.vb" Inherits="Elan_Sample.Email_Server"%>
OCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<HTML>

<HEAD>

<title>Email_Server</title>

<meta name="GENERATOR" content="Microsoft Visual Studio.NET 7.0">

<meta name="CODE_LANGUAGE" content="Visual Basic 7.0">

<meta name="vs_defaultClientScript" content="JavaScript">

<meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5">

</HEAD>

<body MS_POSITIONING="GridLayout">

<form id="Form1" method="post" runat="server">

<asp:TextBox id="txtFrom" style="Z-INDEX: 100; LEFT: 190px; POSITION: absolute; TOP: 62px" runat="server"></asp:TextBox>

<asp:Label id="Label8" style="Z-INDEX: 113; LEFT: 99px; POSITION: absolute; TOP: 212px" runat="server" Width="68px" Height="19px">Body</asp:Label>

<asp:Label id="Label7" style="Z-INDEX: 112; LEFT: 99px; POSITION: absolute; TOP: 156px" runat="server" Width="68px" Height="19px">Subject</asp:Label>

<asp:Label id="Label6" style="Z-INDEX: 111; LEFT: 99px; POSITION: absolute; TOP: 109px" runat="server" Width="68" Height="19">To</asp:Label>

<asp:TextBox id="txtBody" style="Z-INDEX: 109; LEFT: 192px; POSITION: absolute; TOP: 210px" runat="server"></asp:TextBox>

<asp:Label id="Label4" style="Z-INDEX: 102; LEFT: 126px; POSITION: absolute; TOP: 64px" runat="server">Label</asp:Label>

<asp:TextBox id="txtSubject" style="Z-INDEX: 108; LEFT: 193px; POSITION: absolute; TOP: 157px" runat="server"></asp:TextBox>

<asp:Label id="Label3" style="Z-INDEX: 101; LEFT: 126px; POSITION: absolute; TOP: 64px" runat="server">Label</asp:Label>

<asp:TextBox id="txtTo" style="Z-INDEX: 107; LEFT: 192px; POSITION: absolute; TOP: 106px" runat="server"></asp:TextBox>

<asp:Label id="Label2" style="Z-INDEX: 103; LEFT: 126px; POSITION: absolute; TOP: 64px" runat="server">Label</asp:Label>

<asp:Label id="Label1" style="Z-INDEX: 104; LEFT: 99px; POSITION: absolute; TOP: 64px" runat="server" Width="68px" Height="19px">Form</asp:Label>

<asp:Button id="Button1" style="Z-INDEX: 106; LEFT: 291px; POSITION: absolute; TOP: 276px" runat="server" Text="Sent" Width="65px"></asp:Button>

</form>

</body>

</HTML>

Server side Script:

Imports System.Web.Mail

Public Class Email_Server

Inherits System.Web.UI.Page

Protected WithEvents txtFrom As System.Web.UI.WebControls.TextBox

Protected WithEvents Label1 As System.Web.UI.WebControls.Label

Protected WithEvents Button1 As System.Web.UI.WebControls.Button

Protected WithEvents Label2 As System.Web.UI.WebControls.Label

Protected WithEvents txtTo As System.Web.UI.WebControls.TextBox

Protected WithEvents Label3 As System.Web.UI.WebControls.Label

Protected WithEvents txtSubject As System.Web.UI.WebControls.TextBox

Protected WithEvents Label4 As System.Web.UI.WebControls.Label

Protected WithEvents txtBody As System.Web.UI.WebControls.TextBox

Protected WithEvents Label6 As System.Web.UI.WebControls.Label

Protected WithEvents Label7 As System.Web.UI.WebControls.Label

Protected WithEvents Label8 As System.Web.UI.WebControls.Label

#Region " Web Form Designer Generated Code "

'This call is required by the Web Form Designer.

<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()

End Sub

Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init

'CODEGEN: This method call is required by the Web Form Designer

'Do not modify it using the code editor.

InitializeComponent()

End Sub

#End Region

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

'Put user code to initialize the page here

End Sub

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

SmtpMail.SmtpServer = "trainee2.com" ' Trainee2.com is my SMTP Name

SmtpMail.Send(txtFrom.Text, txtTo.Text, txtSubject.Text, txtBody.Text)

End Sub

End Class

--------------------------------------------------------------------------
Thanks & Regards,
ElanKathir.S.N,
ASM Technologies,
B'lore.

Nov 18 '05 #1
5 2119
Hi,

SMTP FAQ
http://www.asp.net/Forums/ShowPost.a...&PostID=268037

--
Teemu Keiski
MCP, Microsoft MVP (ASP.NET), AspInsiders member
ASP.NET Forum Moderator, AspAlliance Columnist
"ElanKathir" <sn**********@hotmail.com> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
Hi !

I wrote one code for Send the E-mail, But that code have some problem , So
please help me

Here i paste my code and Error:
Error:
Server Error in '/Elan_Sample' Application.
--------------------------------------------------------------------------------

The transport failed to connect to the server.
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information
about the error and where it originated in the code.

Exception Details: System.Runtime.InteropServices.COMException: The
transport failed to connect to the server.

Source Error:
Line 36: Private Sub Button1_Click(ByVal sender As System.Object, ByVal
e As System.EventArgs) Handles Button1.Click
Line 37: SmtpMail.SmtpServer = "trainee2.com" ' Trainee2.com is my
SMTP Name
Line 38: SmtpMail.Send(txtFrom.Text, txtTo.Text, txtSubject.Text,
txtBody.Text)
Line 39: End Sub
Line 40: End Class

Source File: C:\Project Files\Root\Elan_Sample\Email Server.aspx.vb Line:
38

Stack Trace:
[COMException (0x80040213): The transport failed to connect to the server.
]

[TargetInvocationException: Exception has been thrown by the target of an
invocation.]
System.RuntimeType.InvokeDispMethod(String name, BindingFlags invokeAttr,
Object target, Object[] args, Boolean[] byrefModifiers, Int32 culture,
String[] namedParameters) +0
System.RuntimeType.InvokeMember(String name, BindingFlags invokeAttr,
Binder binder, Object target, Object[] args, ParameterModifier[] modifiers,
CultureInfo culture, String[] namedParameters) +473
System.Web.Mail.LateBoundAccessHelper.CallMethod(O bject obj, String
methodName, Object[] args) +58

[HttpException (0x80004005): Could not access 'CDO.Message' object.]
System.Web.Mail.LateBoundAccessHelper.CallMethod(O bject obj, String
methodName, Object[] args) +112
System.Web.Mail.CdoSysHelper.Send(MailMessage message) +1840
System.Web.Mail.CdoSysHelper.Send(String from, String to, String subject,
String messageText) +74
System.Web.Mail.SmtpMail.Send(String from, String to, String subject,
String messageText) +171
Elan_Sample.Email_Server.Button1_Click(Object sender, EventArgs e) in
C:\Project Files\Root\Elan_Sample\Email Server.aspx.vb:38
System.Web.UI.WebControls.Button.OnClick(EventArgs e) +108
System.Web.UI.WebControls.Button.System.Web.UI.IPo stBackEventHandler.RaisePostBackEvent(String
eventArgument) +57
System.Web.UI.Page.RaisePostBackEvent(IPostBackEve ntHandler
sourceControl, String eventArgument) +18
System.Web.UI.Page.RaisePostBackEvent(NameValueCol lection postData) +33
System.Web.UI.Page.ProcessRequestMain() +1277


ASP.NET Script :

<%@ Page Language="vb" AutoEventWireup="false" Codebehind="Email
Server.aspx.vb" Inherits="Elan_Sample.Email_Server"%>
OCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<HTML>

<HEAD>

<title>Email_Server</title>

<meta name="GENERATOR" content="Microsoft Visual Studio.NET 7.0">

<meta name="CODE_LANGUAGE" content="Visual Basic 7.0">

<meta name="vs_defaultClientScript" content="JavaScript">

<meta name="vs_targetSchema"
content="http://schemas.microsoft.com/intellisense/ie5">

</HEAD>

<body MS_POSITIONING="GridLayout">

<form id="Form1" method="post" runat="server">

<asp:TextBox id="txtFrom" style="Z-INDEX: 100; LEFT: 190px; POSITION:
absolute; TOP: 62px" runat="server"></asp:TextBox>

<asp:Label id="Label8" style="Z-INDEX: 113; LEFT: 99px; POSITION: absolute;
TOP: 212px" runat="server" Width="68px" Height="19px">Body</asp:Label>

<asp:Label id="Label7" style="Z-INDEX: 112; LEFT: 99px; POSITION: absolute;
TOP: 156px" runat="server" Width="68px" Height="19px">Subject</asp:Label>

<asp:Label id="Label6" style="Z-INDEX: 111; LEFT: 99px; POSITION: absolute;
TOP: 109px" runat="server" Width="68" Height="19">To</asp:Label>

<asp:TextBox id="txtBody" style="Z-INDEX: 109; LEFT: 192px; POSITION:
absolute; TOP: 210px" runat="server"></asp:TextBox>

<asp:Label id="Label4" style="Z-INDEX: 102; LEFT: 126px; POSITION: absolute;
TOP: 64px" runat="server">Label</asp:Label>

<asp:TextBox id="txtSubject" style="Z-INDEX: 108; LEFT: 193px; POSITION:
absolute; TOP: 157px" runat="server"></asp:TextBox>

<asp:Label id="Label3" style="Z-INDEX: 101; LEFT: 126px; POSITION: absolute;
TOP: 64px" runat="server">Label</asp:Label>

<asp:TextBox id="txtTo" style="Z-INDEX: 107; LEFT: 192px; POSITION:
absolute; TOP: 106px" runat="server"></asp:TextBox>

<asp:Label id="Label2" style="Z-INDEX: 103; LEFT: 126px; POSITION: absolute;
TOP: 64px" runat="server">Label</asp:Label>

<asp:Label id="Label1" style="Z-INDEX: 104; LEFT: 99px; POSITION: absolute;
TOP: 64px" runat="server" Width="68px" Height="19px">Form</asp:Label>

<asp:Button id="Button1" style="Z-INDEX: 106; LEFT: 291px; POSITION:
absolute; TOP: 276px" runat="server" Text="Sent" Width="65px"></asp:Button>

</form>

</body>

</HTML>

Server side Script:

Imports System.Web.Mail

Public Class Email_Server

Inherits System.Web.UI.Page

Protected WithEvents txtFrom As System.Web.UI.WebControls.TextBox

Protected WithEvents Label1 As System.Web.UI.WebControls.Label

Protected WithEvents Button1 As System.Web.UI.WebControls.Button

Protected WithEvents Label2 As System.Web.UI.WebControls.Label

Protected WithEvents txtTo As System.Web.UI.WebControls.TextBox

Protected WithEvents Label3 As System.Web.UI.WebControls.Label

Protected WithEvents txtSubject As System.Web.UI.WebControls.TextBox

Protected WithEvents Label4 As System.Web.UI.WebControls.Label

Protected WithEvents txtBody As System.Web.UI.WebControls.TextBox

Protected WithEvents Label6 As System.Web.UI.WebControls.Label

Protected WithEvents Label7 As System.Web.UI.WebControls.Label

Protected WithEvents Label8 As System.Web.UI.WebControls.Label

#Region " Web Form Designer Generated Code "

'This call is required by the Web Form Designer.

<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()

End Sub

Private Sub Page_Init(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Init

'CODEGEN: This method call is required by the Web Form Designer

'Do not modify it using the code editor.

InitializeComponent()

End Sub

#End Region

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load

'Put user code to initialize the page here

End Sub

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click

SmtpMail.SmtpServer = "trainee2.com" ' Trainee2.com is my SMTP Name

SmtpMail.Send(txtFrom.Text, txtTo.Text, txtSubject.Text, txtBody.Text)

End Sub

End Class

--------------------------------------------------------------------------
Thanks & Regards,
ElanKathir.S.N,
ASM Technologies,
B'lore.
Nov 18 '05 #2
Hi Teemu Keiski,

This is my Code,

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click

Dim mailMessage As System.Web.Mail.MailMessage

mailMessage = New System.Web.Mail.MailMessage()

mailMessage.From = "me@contoso.com "

mailMessage.To = "yo*@contoso.com "

mailMessage.Subject = "Test subject"

mailMessage.BodyFormat = System.Web.Mail.MailFormat.Text

mailMessage.Body = "Testing email "

System.Web.Mail.SmtpMail.SmtpServer = "localhost"

Try

System.Web.Mail.SmtpMail.Send(mailMessage)
Response.Write("Message sent!")

Catch ex As Exception

Response.Write(ex.Message)

End Try
End Sub
I add Referce also (Add the cdosys.dll), But i got the One Error
massage:

Could not access 'CDO.Message' object.

Why this Came ?..........

Thanks & Regards

Elankathir,
B'lore,
India.

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 18 '05 #3
ElanKathir .S.N <el*************@yahoo.co.in> wrote in news:OyQGc1F9DHA.1596
@TK2MSFTNGP10.phx.gbl:
Could not access 'CDO.Message' object.

Why this Came ?..........


Do you have CDO installed?

You might also try Indy, its free and has broader support for SMTP than .net
does.

http://www.indyproject.org/

There is an SMTP example at:
http://www.atozed.com/indy/

Indy does not require CDO.
--
Chad Z. Hower (a.k.a. Kudzu) - http://www.hower.org/Kudzu/
"Programming is an art form that fights back"
ELKNews - Get your free copy at http://www.atozedsoftware.com

Nov 18 '05 #4
Change
Catch ex As Exception
Response.Write(ex.Message)
To
Catch ex As Exception
Response.Write(ex.InnerException.Message)

That should give you a better clue as to where the problem lies.

"ElanKathir .S.N" <el*************@yahoo.co.in> wrote in message
news:Oy**************@TK2MSFTNGP10.phx.gbl...
Hi Teemu Keiski,

This is my Code,

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click

Dim mailMessage As System.Web.Mail.MailMessage

mailMessage = New System.Web.Mail.MailMessage()

mailMessage.From = "me@contoso.com "

mailMessage.To = "yo*@contoso.com "

mailMessage.Subject = "Test subject"

mailMessage.BodyFormat = System.Web.Mail.MailFormat.Text

mailMessage.Body = "Testing email "

System.Web.Mail.SmtpMail.SmtpServer = "localhost"

Try

System.Web.Mail.SmtpMail.Send(mailMessage)
Response.Write("Message sent!")

Catch ex As Exception

Response.Write(ex.Message)

End Try
End Sub
I add Referce also (Add the cdosys.dll), But i got the One Error
massage:

Could not access 'CDO.Message' object.

Why this Came ?..........

Thanks & Regards

Elankathir,
B'lore,
India.

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Nov 18 '05 #5
Hi ElanKathir,

I don't think SMTP virtual server is installed on your IIS.it is part of IIS but you need to install it.
Go to your IIS and look for Default SMTP Virtiual Server.If it is not there install it using the Windows CD.
Here is link which will help you on that.
http://www.microsoft.com/technet/tre...mail_setup.asp
Hope this helps.
Regards,
Marshal Antony
..NET Developer
http://www.dotnetmarshal.com
"ElanKathir" <sn**********@hotmail.com> wrote in message news:%2****************@tk2msftngp13.phx.gbl...
Hi !

I wrote one code for Send the E-mail, But that code have some problem , So please help me

Here i paste my code and Error:
Error:
Server Error in '/Elan_Sample' Application.
------------------------------------------------------------------------------

The transport failed to connect to the server.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Runtime.InteropServices.COMException: The transport failed to connect to the server.

Source Error:
Line 36: Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Line 37: SmtpMail.SmtpServer = "trainee2.com" ' Trainee2.com is my SMTP Name
Line 38: SmtpMail.Send(txtFrom.Text, txtTo.Text, txtSubject.Text, txtBody.Text)
Line 39: End Sub
Line 40: End Class
Source File: C:\Project Files\Root\Elan_Sample\Email Server.aspx.vb Line: 38

Stack Trace:
[COMException (0x80040213): The transport failed to connect to the server.
]

[TargetInvocationException: Exception has been thrown by the target of an invocation.]
System.RuntimeType.InvokeDispMethod(String name, BindingFlags invokeAttr, Object target, Object[] args, Boolean[] byrefModifiers, Int32 culture, String[] namedParameters) +0
System.RuntimeType.InvokeMember(String name, BindingFlags invokeAttr, Binder binder, Object target, Object[] args, ParameterModifier[] modifiers, CultureInfo culture, String[] namedParameters) +473
System.Web.Mail.LateBoundAccessHelper.CallMethod(O bject obj, String methodName, Object[] args) +58

[HttpException (0x80004005): Could not access 'CDO.Message' object.]
System.Web.Mail.LateBoundAccessHelper.CallMethod(O bject obj, String methodName, Object[] args) +112
System.Web.Mail.CdoSysHelper.Send(MailMessage message) +1840
System.Web.Mail.CdoSysHelper.Send(String from, String to, String subject, String messageText) +74
System.Web.Mail.SmtpMail.Send(String from, String to, String subject, String messageText) +171
Elan_Sample.Email_Server.Button1_Click(Object sender, EventArgs e) in C:\Project Files\Root\Elan_Sample\Email Server.aspx.vb:38
System.Web.UI.WebControls.Button.OnClick(EventArgs e) +108
System.Web.UI.WebControls.Button.System.Web.UI.IPo stBackEventHandler.RaisePostBackEvent(String eventArgument) +57
System.Web.UI.Page.RaisePostBackEvent(IPostBackEve ntHandler sourceControl, String eventArgument) +18
System.Web.UI.Page.RaisePostBackEvent(NameValueCol lection postData) +33
System.Web.UI.Page.ProcessRequestMain() +1277



ASP.NET Script :

<%@ Page Language="vb" AutoEventWireup="false" Codebehind="Email Server.aspx.vb" Inherits="Elan_Sample.Email_Server"%>
OCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<HTML>

<HEAD>

<title>Email_Server</title>

<meta name="GENERATOR" content="Microsoft Visual Studio.NET 7.0">

<meta name="CODE_LANGUAGE" content="Visual Basic 7.0">

<meta name="vs_defaultClientScript" content="JavaScript">

<meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5">

</HEAD>

<body MS_POSITIONING="GridLayout">

<form id="Form1" method="post" runat="server">

<asp:TextBox id="txtFrom" style="Z-INDEX: 100; LEFT: 190px; POSITION: absolute; TOP: 62px" runat="server"></asp:TextBox>

<asp:Label id="Label8" style="Z-INDEX: 113; LEFT: 99px; POSITION: absolute; TOP: 212px" runat="server" Width="68px" Height="19px">Body</asp:Label>

<asp:Label id="Label7" style="Z-INDEX: 112; LEFT: 99px; POSITION: absolute; TOP: 156px" runat="server" Width="68px" Height="19px">Subject</asp:Label>

<asp:Label id="Label6" style="Z-INDEX: 111; LEFT: 99px; POSITION: absolute; TOP: 109px" runat="server" Width="68" Height="19">To</asp:Label>

<asp:TextBox id="txtBody" style="Z-INDEX: 109; LEFT: 192px; POSITION: absolute; TOP: 210px" runat="server"></asp:TextBox>

<asp:Label id="Label4" style="Z-INDEX: 102; LEFT: 126px; POSITION: absolute; TOP: 64px" runat="server">Label</asp:Label>

<asp:TextBox id="txtSubject" style="Z-INDEX: 108; LEFT: 193px; POSITION: absolute; TOP: 157px" runat="server"></asp:TextBox>

<asp:Label id="Label3" style="Z-INDEX: 101; LEFT: 126px; POSITION: absolute; TOP: 64px" runat="server">Label</asp:Label>

<asp:TextBox id="txtTo" style="Z-INDEX: 107; LEFT: 192px; POSITION: absolute; TOP: 106px" runat="server"></asp:TextBox>

<asp:Label id="Label2" style="Z-INDEX: 103; LEFT: 126px; POSITION: absolute; TOP: 64px" runat="server">Label</asp:Label>

<asp:Label id="Label1" style="Z-INDEX: 104; LEFT: 99px; POSITION: absolute; TOP: 64px" runat="server" Width="68px" Height="19px">Form</asp:Label>

<asp:Button id="Button1" style="Z-INDEX: 106; LEFT: 291px; POSITION: absolute; TOP: 276px" runat="server" Text="Sent" Width="65px"></asp:Button>

</form>

</body>

</HTML>

Server side Script:

Imports System.Web.Mail

Public Class Email_Server

Inherits System.Web.UI.Page

Protected WithEvents txtFrom As System.Web.UI.WebControls.TextBox

Protected WithEvents Label1 As System.Web.UI.WebControls.Label

Protected WithEvents Button1 As System.Web.UI.WebControls.Button

Protected WithEvents Label2 As System.Web.UI.WebControls.Label

Protected WithEvents txtTo As System.Web.UI.WebControls.TextBox

Protected WithEvents Label3 As System.Web.UI.WebControls.Label

Protected WithEvents txtSubject As System.Web.UI.WebControls.TextBox

Protected WithEvents Label4 As System.Web.UI.WebControls.Label

Protected WithEvents txtBody As System.Web.UI.WebControls.TextBox

Protected WithEvents Label6 As System.Web.UI.WebControls.Label

Protected WithEvents Label7 As System.Web.UI.WebControls.Label

Protected WithEvents Label8 As System.Web.UI.WebControls.Label

#Region " Web Form Designer Generated Code "

'This call is required by the Web Form Designer.

<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()

End Sub

Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init

'CODEGEN: This method call is required by the Web Form Designer

'Do not modify it using the code editor.

InitializeComponent()

End Sub

#End Region

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

'Put user code to initialize the page here

End Sub

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

SmtpMail.SmtpServer = "trainee2.com" ' Trainee2.com is my SMTP Name

SmtpMail.Send(txtFrom.Text, txtTo.Text, txtSubject.Text, txtBody.Text)

End Sub

End Class

--------------------------------------------------------------------------
Thanks & Regards,
ElanKathir.S.N,
ASM Technologies,
B'lore.
Nov 18 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
by: Kostatus | last post by:
I have a virtual function in a base class, which is then overwritten by a function of the same name in a publically derived class. When I call the function using a pointer to the derived class...
117
by: Peter Olcott | last post by:
www.halting-problem.com
17
by: Jon Slaughter | last post by:
I'm having a little trouble understanding what the slicing problem is. In B.S.'s C++ PL3rdEd he says "Becayse the Employee copy functions do not know anything about Managers, only the Employee...
0
by: James Griffiths | last post by:
Here is a report I've written about a printing problem that is being experienced by a particular company for whom I had developed a A97 system. After upgrading to Win XP and AXP, some printing...
4
by: Trond Meistad | last post by:
I have a website where I run a simple asp.net web application. On Sunday night, requests to this webapplication started to time out. After much debuggeing with no result, I created a new...
6
by: Ammar | last post by:
Dear All, I'm facing a small problem. I have a portal web site, that contains articles, for each article, the end user can send a comment about the article. The problem is: I the comment length...
5
by: Dany C. | last post by:
We have install a valid SSL certificate issued to www.mycompany.com on our web server running IIS 6.0 / win2003 SP1. Then we have created a sub domain pointing to the same server for our web...
2
by: Mike Collins | last post by:
I cannot get the correct drop down list value from a drop down I have on my web form. I get the initial value that was loaded in the list. It was asked by someone else what the autopostback was...
7
by: Trickynick1001 | last post by:
Hi, a newbie here. I don't have a real firm grasp on the idea of Javascript, as I'm used to programming in Qbasic and C. I'm not used to OOP. Anyway, I really don't have any idea what the...
2
by: tharu80 | last post by:
Hi,Im in final year student. my graduation project is making sms orders for the online shop.So i need the coding for senting the sms from the pc to mobile and receiving the sms from the mobile to...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.