|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
SENDMailmuch as I can about VB and ASP2.0. Now the question I have is I created an E-Mail form the sendmail properties in the VB side are Imports System.Net.Mail Partial Class _Default Inherits System.Web.UI.Page Protected Sub Wizard1_FinishButtonClick(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.WizardNavigationEventArgs) Handles Wizard1.FinishButtonClick SendMail(TXTEMail.Text, TXTComments.Text) End Sub Private Sub SendMail(ByVal from As String, ByVal body As String) Dim mailServerName As String = "My.Mail.Server" Dim message As MailMessage = New MailMessage(from, "M*@email.com", "Sent from E-Form", body) Dim mailClient As SmtpClient = New SmtpClient mailClient.Host = mailServerName mailclient.Send(message) message.Dispose() End Sub The problem is I have four items that I want sent to me but right now all I can get are the two listed in SendMail(TXTEMail.Text, TXTComments.Text) I also want my Subject and Name boxes sent as well. If i add them to the SendMail(TXTEMail.Text, TXTComments.Text) I get an error. What am I doing wrong and do i have this all wrong? Help in coding would be appreciated and where it goes. Thanks in advance
Show quote
Hide quote
"James Robertson" <jrobert***@calaveras.k12.ca.us> wrote in message news:536CB917-5B11-4D90-B048-747049CC97BA@microsoft.com... Use this and hack it to suit:> Issue is that I really do not know diddly. Copying and trying to learn as > much as I can about VB and ASP2.0. Now the question I have is I created an > E-Mail form the sendmail properties in the VB side are > > Imports System.Net.Mail > > Partial Class _Default > Inherits System.Web.UI.Page > > Protected Sub Wizard1_FinishButtonClick(ByVal sender As Object, ByVal e > As System.Web.UI.WebControls.WizardNavigationEventArgs) Handles > Wizard1.FinishButtonClick > SendMail(TXTEMail.Text, TXTComments.Text) > End Sub > > Private Sub SendMail(ByVal from As String, ByVal body As String) > Dim mailServerName As String = "My.Mail.Server" > Dim message As MailMessage = New MailMessage(from, "M*@email.com", > "Sent from E-Form", body) > Dim mailClient As SmtpClient = New SmtpClient > mailClient.Host = mailServerName > mailclient.Send(message) > message.Dispose() > End Sub > > The problem is I have four items that I want sent to me but right now all I > can get are the two listed in SendMail(TXTEMail.Text, TXTComments.Text) I > also want my Subject and Name boxes sent as well. If i add them to the > SendMail(TXTEMail.Text, TXTComments.Text) I get an error. What am I doing > wrong and do i have this all wrong? Help in coding would be appreciated and > where it goes. > > Thanks in advance Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) _ Handles MyBase.Load Dim myTo As MailAddress, myFrom As MailAddress Dim myClient As SmtpClient, myMessage As MailMessage 'A simple message myMessage = New MailMessage("Person1_AT_mail_DOT_com", "Person2_AT_mail_DOT_com", _ "This is the simple subject", "This is the simple body") myClient = New SmtpClient("smtp.server.net") myClient.Send(myMessage) 'A more complex example myTo = New MailAddress("Person1_AT_mail_DOT_com", "FirstNameA SecondNameA") myFrom = New MailAddress("Person2_AT_mail_DOT_com", "FirstNameB SecondNameB") myMessage = New MailMessage(myFrom, myTo) myMessage.To.Add("Person3_AT_mail_DOT_com") myMessage.Bcc.Add("Person4_AT_mail_DOT_com") myMessage.Subject = ("This is the subject") myMessage.IsBodyHtml = True myMessage.Body = ("<B>This is the body</B>") myMessage.Attachments.Add(New Attachment("C:\MyLargeImage1.bmp")) myMessage.Attachments.Add(New Attachment("C:\MyLargeImage2.bmp")) myMessage.Attachments.Add(New Attachment("C:\MySmallImage1.bmp")) myMessage.Attachments.Add(New Attachment("C:\MySmallImage2.bmp")) 'myClient = New SmtpClient("smtp.server.net") myClient.Send(myMessage) End Sub
Get the selected value from a listbox
Help Needed WIth Printing BN.NET 2005 Can't close EXCEL from my VB.NET application Passing a Variable from one web site to another for ASP Importing from Excel dll not reading .config ? ContainsFocus equivalent in VB Use active directory to scan for software on a remote system? Get Memory Usage of my Program Reading an argument given to the program when started |
|||||||||||||||||||||||