russellmunday
Technical User
im' not trying to do something impossible here most of this code comes from the examples but when i run it it stops at the send line "smtpmail.send(mymail)"
Imports System.Web.mail
Public Class WebForm1
Inherits System.Web.UI.Page
#Region " Web Form Designer Generated Code "
'This call is required by the Web Form Designer.
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
End Sub
Protected WithEvents Button1 As System.Web.UI.WebControls.Button
Protected WithEvents TextBox1 As System.Web.UI.WebControls.TextBox
'NOTE: The following placeholder declaration is required by the Web Form Designer.
'Do not delete or move it.
Private designerPlaceholderDeclaration As System.Object
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 nmail()
'sending the email
Dim ssmtp As String
Dim sto As String
Dim ssub As String
Dim sbody As String
Dim sattach As String
Dim mymail As MailMessage = New MailMessage
ssmtp = "smtp.dsl.pipex.com"
sto = "myaddress@mydomain.com"
sbody = "Please see Attached Files"
ssub = "hello"
mymail.To = sto
mymail.Subject = ssub
mymail.Body = sbody
SmtpMail.SmtpServer = "smtp.dsl.pipex.com"
SmtpMail.Send(mymail)
End Sub
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
Call nmail()
End Sub
End Class
Imports System.Web.mail
Public Class WebForm1
Inherits System.Web.UI.Page
#Region " Web Form Designer Generated Code "
'This call is required by the Web Form Designer.
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
End Sub
Protected WithEvents Button1 As System.Web.UI.WebControls.Button
Protected WithEvents TextBox1 As System.Web.UI.WebControls.TextBox
'NOTE: The following placeholder declaration is required by the Web Form Designer.
'Do not delete or move it.
Private designerPlaceholderDeclaration As System.Object
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 nmail()
'sending the email
Dim ssmtp As String
Dim sto As String
Dim ssub As String
Dim sbody As String
Dim sattach As String
Dim mymail As MailMessage = New MailMessage
ssmtp = "smtp.dsl.pipex.com"
sto = "myaddress@mydomain.com"
sbody = "Please see Attached Files"
ssub = "hello"
mymail.To = sto
mymail.Subject = ssub
mymail.Body = sbody
SmtpMail.SmtpServer = "smtp.dsl.pipex.com"
SmtpMail.Send(mymail)
End Sub
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
Call nmail()
End Sub
End Class