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

Sending Mail

Hi all!
I have a small form created with VS2005 (Visual Basic)
on that form i have 5 text boxes and 4 combo boxes.
(the 4 combo boxes are data bind to an sql 2000 DB)

i'v created a button and used an onclick snippet for sending email.
(it works :) )

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles EmailSubmitBTN.Click
Dim message As New MailMessage("xxx@xxx", "xxx@xxx",
"subject", "A new request has arrived")
Dim emailClient As New SmtpClient("xxx.xxx.xxx")
emailClient.Send(message)

End Sub

Now - the botton does work but i don't really know how to collect all
the data i'v placed in the text boxes and combo boxes to send it along
with the email msg.

so here i am, mumbling nervously to my self because i am no
programmer.. :)
any help with be greatly appreciates.....(code smaples will be mostly
appreciates)

Thanks!

50.

May 2 '07 #1
3 1494
On May 2, 8:32 am, 5070...@gmail.com wrote:
Hi all!
I have a small form created with VS2005 (Visual Basic)
on that form i have 5 text boxes and 4 combo boxes.
(the 4 combo boxes are data bind to an sql 2000 DB)

i'v created a button and used an onclick snippet for sending email.
(it works :) )

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles EmailSubmitBTN.Click
Dim message As New MailMessage("xxx@xxx", "xxx@xxx",
"subject", "A new request has arrived")
Dim emailClient As New SmtpClient("xxx.xxx.xxx")
emailClient.Send(message)

End Sub

Now - the botton does work but i don't really know how to collect all
the data i'v placed in the text boxes and combo boxes to send it along
with the email msg.

so here i am, mumbling nervously to my self because i am no
programmer.. :)
any help with be greatly appreciates.....(code smaples will be mostly
appreciates)

Thanks!

50.
You can reference a control's property by using
"Me.ControlName.PropertyName" So in this case if you wanted the Text
property of a textbox named "TextBox1" you would use Me.TextBox1.Text.

So you could change your code to something like this:

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles EmailSubmitBTN.Click
Dim body As String = Me.TextBox1.Text & Me.TextBox2.Text &
Me.ComboBox1.Text ' etc
Dim message As New MailMessage("xxx@xxx", "xxx@xxx",
"subject", body)
Dim emailClient As New SmtpClient("xxx.xxx.xxx")
emailClient.Send(message)
End Sub

Thanks,

Seth Rowe

May 2 '07 #2
Hi 5070707,
You just need to set the properties of your mail message object. Such as:

With Message

.From =
.To =
.Body =
.Attachments.Add ( ... )

etc....

End With
You can build the body by appending strings. If speed is an issue here, use
the StringBuilder class. Lookup the function reference for the MailMessage
class to get more information about what you can do with it and how it
works.

Also googling "MailMessage+VB.NET" brings up some more or less useful code
samples and demonstrations.


Robin

May 2 '07 #3
Also googling "MailMessage+VB.NET" brings up some more or less useful code
samples and demonstrations.
One great site is www.systemnetmail.com

Thanks,

Seth Rowe
May 2 '07 #4

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

Similar topics

0
by: praba kar | last post by:
Dear All, I have doubt regarding mail sending smtplib module. The below code is I used to send a mail. ########################################## import email.Message import email.Utils...
10
by: Stuart Mueller | last post by:
I have an exchange server, that I sometimes use to perform mail shots to clients on our database, these can be upwards of 1000 at a time. As we don't want different clients to see who we are...
2
by: Mr. x | last post by:
Hello, I am sending emails with Hebrew contents. When receiving emails - I cannot see the Hebrew characters (it is not outlook express configuration, because when receiving emails from friends -...
3
by: VB Programmer | last post by:
I have an ASPX page where I send out emails through my mail server mail.MyDomain.com. When I send emails to MyName@MyDomain.com it sends PERFECTLY. When I try sending an email to any other address...
3
by: HoustonComputerGuy | last post by:
I am working on getting my web applications moved to .Net 2.0 and am having some problems with System.Net.Mail. I get the following error when sending the mail: System.Net.Mail.SmtpException was...
1
by: Eric Sheu | last post by:
Greetings, I have been searching the web like mad for a solution to my SMTP problem. I am using Windows Server 2003 and ASP.NET 2.0 w/ C# to send out e-mails from a web site I have created to...
2
by: HK | last post by:
In VB.NET, I'm getting the exception "failure sending mail". I'm running VS 2005 on XP Home. This is a new install on a new PC. I've never had email problems with VS 2003, and there I could...
3
by: mfleet1973 | last post by:
Hello Again. I have a program that sends e-mails as follows: Try Dim mail As New MailMessage mail.To = "me@comp.com" mail.From = "me@comp.com mail.Subject = "Test" mail.Body = "Testing123"
9
by: JoeP | last post by:
Hi All, How can I find the reason for such an error: Failure sending mail. Some Code... oMailMessage.IsBodyHtml = False oMailMessage.Body = cEmailBody Dim oSMTP As New SmtpClient...
4
by: =?Utf-8?B?R3V5IENvaGVu?= | last post by:
Hi all I use: Dim message As New MailMessage(txtTo.Text, txtFrom.Text, txtSubject.Text, txtBody.Text) Dim emailClient As New SmtpClient(txtSMTPServer.Text) emailClient.Send(message) And its...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.