473,387 Members | 1,844 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,387 software developers and data experts.

SENDMail

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.WizardNavigationEventArg s) 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, "MY@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
Mar 31 '06 #1
1 2213

"James Robertson" <jr********@calaveras.k12.ca.us> wrote in message news:53**********************************@microsof t.com...
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.WizardNavigationEventArg s) 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, "MY@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


Use this and hack it to suit:

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

Apr 1 '06 #2

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

Similar topics

2
by: Babaloo | last post by:
Hello, I am having a problem with PHP 4.2.2 and RH 8. PHP is working fine except email. I have a test script to send mail, I have sendmail_path = '/usr/lib/sendmail -t -i' set in php.ini,...
4
by: jim | last post by:
Hello, I am having a problem w/SendMail reporting: " No recipient addresses found in header". Funny thing is though, I properly recieve the email message. Thanks for your help. -jim
2
by: mike | last post by:
I've spent a couple of days on this and I'm to the "bang-my-head 'gainst the monitor and babble in tongues" mode. First - SuSE Pro 9.3, Linux 2.6.11.4-21.7, Apache 2.0.53, PHP 4.3.10 I have...
1
by: Gaz | last post by:
Hey. I looked at the Sendmail help and did not find a property where i can get an "ok" signal when the email is finally sent. I need something like that to show a "Processing, please stand by"...
3
by: swangdb | last post by:
I have a Sun Server running Solaris 10 and Sendmail 8.13.7. I have Majordomo and Listproc installed on this server and they work. I have several production majordomo and listproc mailing lists...
4
by: Nilesh | last post by:
I have a server in which sendmail gives problem. How do i change php.ini so that i can use exim for mail() System is FC-6.
0
by: s2rinivasan | last post by:
I am srinivasan I sent a last message hoe to trouble shoot httpd passwd acces problum. In that I didn't menson that OS=RedHat LINUX EL4-2.6.9-5. This question also in the same version. In...
11
by: Taras_96 | last post by:
Hi all, The PHP manual states that: "The Windows implementation of mail() differs in many ways from the Unix implementation. First, it doesn't use a local binary for composing messages but only...
3
by: digitaldiva | last post by:
Hi I am new here and once upon a time I worked with Perl, now I am trying again and need some help: I wrote a Perl script a few years ago that opened an order entry TXT file and sent each...
2
jhoborg
by: jhoborg | last post by:
Hello all, So I'm having trouble using sendmail in a CGI script as the topic title says. Here's what I'm trying to accomplish: User fills out a form, submits it, my CGI script receives this...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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...

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.