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

how to correct this?

i want to send a mail from vb.net windows application.using the following code can't send mail.
cmd = New SqlCommand("select email from tblCompany", con)
dr = cmd.ExecuteReader
While dr.Read
sb.Append(dr.GetString(0) + ";")
End While
Response.Redirect("mailto:email@address.com?Bcc=" + sb.ToString)

in this code sb is string builder,dr is sqldatareader.using above code,can't send mail,but didn't show any error.i have dout in response.redirect line.instead of response.write anything will come.plz help me.
Jun 7 '07 #1
4 1276
kenobewan
4,871 Expert 4TB
Mailto is a client side code that won't work server side I believe.
Jun 7 '07 #2
nateraaaa
663 Expert 512MB
mailto is generally used to open a new email when a user clicks a hyperlink. If you want to create a new email in the code behind you will have to use to System.Web.Mail.MailMessage object.

try something like this.

Expand|Select|Wrap|Line Numbers
  1. System.Web.Mail.MailMessage mail = new System.Web.Mail.MailMessage();
  2. mail.To = to;//Email;
  3. mail.From = from;
  4. mail.Subject = subject;
  5. mail.BodyFormat = MailFormat.Html;
  6. mail.Body = msg;
  7.  
  8. if(file != null)
  9. {
  10. mail.Attachments.Add(new MailAttachment(file));
  11. }
  12.  
  13. SmtpMail.Send(mail);
Good luck

Nathan
Jun 7 '07 #3
Frinavale
9,735 Expert Mod 8TB
Hi there,

Check out the article on how to send an email using .NET.
This article gives a quick example of how to send an email without depending on the client's email application.

-Frinny
Jun 7 '07 #4
Frinavale
9,735 Expert Mod 8TB
i want to send a mail from vb.net windows application.using the following code can't send mail.
cmd = New SqlCommand("select email from tblCompany", con)
dr = cmd.ExecuteReader
While dr.Read
sb.Append(dr.GetString(0) + ";")
End While
Response.Redirect("mailto:email@address.com?Bcc=" + sb.ToString)

in this code sb is string builder,dr is sqldatareader.using above code,can't send mail,but didn't show any error.i have dout in response.redirect line.instead of response.write anything will come.plz help me.
Just wanted to let you know that Response.Redirect("nameOfUrl") is generally used for redirecting the user to another web page that is located in a different location.

-Frinny
Jun 7 '07 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Sarah Tegtmeier | last post by:
Hi I have a question about the correct use of the attribute xsi:schemaLocation. My programm has to process XML files where the value of this attribute causes some problems. The programm is...
1
by: Richard Golebiowski | last post by:
I have been trying to figure this out for quite some time and cannot find any examples in VB.Net or in VB that work correctly. I am working on an application where I want the user to be able to...
2
by: Sean Dockery | last post by:
Which is the following is correct? a) <form ... onSubmit="return checkData()"> b) <form ... onSubmit="return checkData();"> c) <form ... onSubmit="checkData()"> d) <form ......
6
by: Rob Thorpe | last post by:
Given the code:- r = sscanf (s, "%lf", x); What is the correct output if the string s is simply "-" ? If "-" is considered the beginning of a number, that has been cut-short then the...
5
by: blackg | last post by:
Input string not in correct format -------------------------------------------------------------------------------- I am trying to view a picture from a table. I am getting this error Input string...
4
by: **Developer** | last post by:
I looked at MSDN and a book and both described the naming convention for parameters should be camel style. The book used camel, except for Set (ByVal Value as ...) There it always used an...
2
by: thisis | last post by:
Hi All, I need the PUBS.mdb for pulling images: PUBS.mdb must have the table: pub_info tbl_pub_info : has 3 fields Data_Type : ok Data_Type : ok
0
by: sehguh | last post by:
Hiya Folks, I am Currently using windows xp. Also using Visual Web Developer 2005 and Microsoft Sql server 2005. The main page consists of an aspx page and a master page. The page also...
3
lee123
by: lee123 | last post by:
I have a problem getting the correct to count +1 every time I get an answer right and the incorrect is the same. I have two lbl's named number1 and number2 which produces a Rnd# in each lbl. ...
10
by: onetruelove | last post by:
I want to creat a post like this blog: http://onlinetoefltest.blogspot.com/2007/08/level-c-lesson-1.html When you chose all the answers and click show answer a msg box will appear and tells how...
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:
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: 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
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.