472,988 Members | 2,550 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,988 software developers and data experts.

sending email in .Net

Somebody knows how I queue email using .Net?

thanks a lot
Nov 19 '05 #1
6 2352
Somebody doesn't know how to Google.
That has got to be the most-often-answered question here.

http://www.google.com/search?as_q=as...h=&safe=images


Juan T. Llibre
ASP.NET MVP
http://asp.net.do/foros/
Foros de ASP.NET en Español
Ven, y hablemos de ASP.NET...
======================

"Eduardo Rosa" <ed*****@clas.com.br> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
Somebody knows how I queue email using .Net?

thanks a lot

Nov 19 '05 #2
ok then...
I wrote queue not for ornament, because I've work a lot with ASP and it need
third-party component to do that.
I was hurry and maybe should wrote the word in uppercase because what I
found in google it most 3rd-party too. So I'll ask again, most precise ok
Juan?

A loop with a many e-mail list works in ASP.Net, unlike classic ASP?
Somebody know how I queue e-mail in ASP.Net without 3rd-party component?
"Juan T. Llibre" <no***********@nowhere.com> escreveu na mensagem
news:eV**************@TK2MSFTNGP14.phx.gbl...
Somebody doesn't know how to Google.
That has got to be the most-often-answered question here.

http://www.google.com/search?as_q=as...h=&safe=images


Juan T. Llibre
ASP.NET MVP
http://asp.net.do/foros/
Foros de ASP.NET en Español
Ven, y hablemos de ASP.NET...
======================

"Eduardo Rosa" <ed*****@clas.com.br> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
Somebody knows how I queue email using .Net?

thanks a lot


Nov 19 '05 #3
Eduardo,

when you say "queue", do you mean getting a list of email
addresses from a database and sending emails to all of them ?

If so, here's a sample :

<%@ Page Language="VB" %>
<%@ import Namespace="System.Data" %>
<%@ import Namespace="System.Web.Mail" %>
<script runat="server">

Sub Page_Load(Src as object, E as EventArgs)

Dim P, U, Em As String
Dim connectionString As String = "server='YourSQLServerName'; trusted_connection=true; database='YourSQLServerDatabase"
Dim dbConnection As IDbConnection = New SqlClient.SqlConnection(connectionString)

Dim queryString As String = "SELECT UserName, Password, Email FROM Users"
Dim dbCommand As IDbCommand = New SqlClient.SqlCommand
dbCommand.CommandText = queryString
dbCommand.Connection = dbConnection

dbConnection.Open
Dim dataReader As IDataReader = dbCommand.ExecuteReader(CommandBehavior.CloseConne ction)

While dataReader.Read()
U = dataReader("Username").ToString()
P = dataReader("Password").ToString()
Em = dataReader("Email").ToString()

' Build a MailMessage
Dim mail As System.Web.Mail.MailMessage = New System.Web.Mail.MailMessage
mail.From = "yo******@yourmailserver.com"
mail.To = Em
mail.Subject = "Your Email's subject."
mail.BodyFormat = System.Web.Mail.MailFormat.Html

mail.Body="Hello, " & U & ".<p>Your Username is " & U & " and your password is " & P & ".<p>
And the rest of your HMTL message goes here..."

System.Web.Mail.SmtpMail.SmtpServer = "your.smtp.server"
System.Web.Mail.SmtpMail.Send(mail)
End While

End Sub
</script>
<html>
<head>
</head>
<body>
</body>
</html>

When you open that page, an email with the contents you specify
will be sent to every email address in the Email column in the Users
table in your SQL Server Database.


Juan T. Llibre
ASP.NET MVP
http://asp.net.do/foros/
Foros de ASP.NET en Español
Ven, y hablemos de ASP.NET...
======================

"Eduardo Rosa" <ed*****@clas.com.br> wrote in message news:ub**************@TK2MSFTNGP12.phx.gbl...
ok then...
I wrote queue not for ornament, because I've work a lot with ASP and it need
third-party component to do that.
I was hurry and maybe should wrote the word in uppercase because what I
found in google it most 3rd-party too. So I'll ask again, most precise ok
Juan?

A loop with a many e-mail list works in ASP.Net, unlike classic ASP?
Somebody know how I queue e-mail in ASP.Net without 3rd-party component?


"Juan T. Llibre" <no***********@nowhere.com> escreveu na mensagem
news:eV**************@TK2MSFTNGP14.phx.gbl...
Somebody doesn't know how to Google.
That has got to be the most-often-answered question here.

http://www.google.com/search?as_q=as...h=&safe=images


Juan T. Llibre
ASP.NET MVP
http://asp.net.do/foros/
Foros de ASP.NET en Español
Ven, y hablemos de ASP.NET...
======================

"Eduardo Rosa" <ed*****@clas.com.br> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
Somebody knows how I queue email using .Net?

thanks a lot


Nov 19 '05 #4
Using classic ASP that page will execute until all e-mail had be sended, if that number e-mails are big the script can execed the timeout, some components give to server manage the e-mail sendind, so the script runs fast. My doubt is: some class in default .Net library can do that or I need a 3rd party?

exemple of components for classic ASP

AspQMail (http://www.serverobjects.com/comp/AspQMail.htm)

ASPEmail (www.persits.com), por exemplo o o método queue:
Enables message queuing.
False by default. If set to True, specifies that a subsequent call to Send will place the message in a message queue to be processed by EmailAgent.
This is a premium feature.
thanks a lot Juan

"Juan T. Llibre" <no***********@nowhere.com> escreveu na mensagem news:eG**************@tk2msftngp13.phx.gbl...
Eduardo,

when you say "queue", do you mean getting a list of email
addresses from a database and sending emails to all of them ?

If so, here's a sample :

<%@ Page Language="VB" %>
<%@ import Namespace="System.Data" %>
<%@ import Namespace="System.Web.Mail" %>
<script runat="server">

Sub Page_Load(Src as object, E as EventArgs)

Dim P, U, Em As String
Dim connectionString As String = "server='YourSQLServerName'; trusted_connection=true; database='YourSQLServerDatabase"
Dim dbConnection As IDbConnection = New SqlClient.SqlConnection(connectionString)

Dim queryString As String = "SELECT UserName, Password, Email FROM Users"
Dim dbCommand As IDbCommand = New SqlClient.SqlCommand
dbCommand.CommandText = queryString
dbCommand.Connection = dbConnection

dbConnection.Open
Dim dataReader As IDataReader = dbCommand.ExecuteReader(CommandBehavior.CloseConne ction)

While dataReader.Read()
U = dataReader("Username").ToString()
P = dataReader("Password").ToString()
Em = dataReader("Email").ToString()

' Build a MailMessage
Dim mail As System.Web.Mail.MailMessage = New System.Web.Mail.MailMessage
mail.From = "yo******@yourmailserver.com"
mail.To = Em
mail.Subject = "Your Email's subject."
mail.BodyFormat = System.Web.Mail.MailFormat.Html

mail.Body="Hello, " & U & ".<p>Your Username is " & U & " and your password is " & P & ".<p>
And the rest of your HMTL message goes here..."

System.Web.Mail.SmtpMail.SmtpServer = "your.smtp.server"
System.Web.Mail.SmtpMail.Send(mail)
End While

End Sub
</script>
<html>
<head>
</head>
<body>
</body>
</html>

When you open that page, an email with the contents you specify
will be sent to every email address in the Email column in the Users
table in your SQL Server Database.


Juan T. Llibre
ASP.NET MVP
http://asp.net.do/foros/
Foros de ASP.NET en Español
Ven, y hablemos de ASP.NET...
======================

"Eduardo Rosa" <ed*****@clas.com.br> wrote in message news:ub**************@TK2MSFTNGP12.phx.gbl...
ok then...
I wrote queue not for ornament, because I've work a lot with ASP and it need
third-party component to do that.
I was hurry and maybe should wrote the word in uppercase because what I
found in google it most 3rd-party too. So I'll ask again, most precise ok
Juan?

A loop with a many e-mail list works in ASP.Net, unlike classic ASP?
Somebody know how I queue e-mail in ASP.Net without 3rd-party component?


"Juan T. Llibre" <no***********@nowhere.com> escreveu na mensagem
news:eV**************@TK2MSFTNGP14.phx.gbl...
Somebody doesn't know how to Google.
That has got to be the most-often-answered question here.

http://www.google.com/search?as_q=as...h=&safe=images


Juan T. Llibre
ASP.NET MVP
http://asp.net.do/foros/
Foros de ASP.NET en Español
Ven, y hablemos de ASP.NET...
======================

"Eduardo Rosa" <ed*****@clas.com.br> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
Somebody knows how I queue email using .Net?

thanks a lot


Nov 19 '05 #5
re:
if that number e-mails are big the script can execed the timeout
You can increase the timeout, so that the page has time to complete.
Check web.config's <httpRuntime executionTimeout="90" ... />

and set it to however long you need.

Juan T. Llibre
ASP.NET MVP
http://asp.net.do/foros/
Foros de ASP.NET en Español
Ven, y hablemos de ASP.NET...
======================

"Eduardo Rosa" <ed*****@clas.com.br> wrote in message
news:uP**************@TK2MSFTNGP10.phx.gbl...
Using classic ASP that page will execute until all e-mail had be sended, if that number
e-mails are big the script can execed the timeout, some components give to server manage
the e-mail sendind, so the script runs fast. My doubt is: some class in default .Net
library can do that or I need a 3rd party?

exemple of components for classic ASP

AspQMail (http://www.serverobjects.com/comp/AspQMail.htm)

ASPEmail (www.persits.com), por exemplo o o método queue:
Enables message queuing.
False by default. If set to True, specifies that a subsequent call to Send will place
the message in a message queue to be processed by EmailAgent.
This is a premium feature.
thanks a lot Juan

"Juan T. Llibre" <no***********@nowhere.com> escreveu na mensagem
news:eG**************@tk2msftngp13.phx.gbl...
Eduardo,

when you say "queue", do you mean getting a list of email
addresses from a database and sending emails to all of them ?

If so, here's a sample :

<%@ Page Language="VB" %>
<%@ import Namespace="System.Data" %>
<%@ import Namespace="System.Web.Mail" %>
<script runat="server">

Sub Page_Load(Src as object, E as EventArgs)

Dim P, U, Em As String
Dim connectionString As String = "server='YourSQLServerName'; trusted_connection=true;
database='YourSQLServerDatabase"
Dim dbConnection As IDbConnection = New SqlClient.SqlConnection(connectionString)

Dim queryString As String = "SELECT UserName, Password, Email FROM Users"
Dim dbCommand As IDbCommand = New SqlClient.SqlCommand
dbCommand.CommandText = queryString
dbCommand.Connection = dbConnection

dbConnection.Open
Dim dataReader As IDataReader = dbCommand.ExecuteReader(CommandBehavior.CloseConne ction)

While dataReader.Read()
U = dataReader("Username").ToString()
P = dataReader("Password").ToString()
Em = dataReader("Email").ToString()

' Build a MailMessage
Dim mail As System.Web.Mail.MailMessage = New System.Web.Mail.MailMessage
mail.From = "yo******@yourmailserver.com"
mail.To = Em
mail.Subject = "Your Email's subject."
mail.BodyFormat = System.Web.Mail.MailFormat.Html

mail.Body="Hello, " & U & ".<p>Your Username is " & U & " and your password is " & P &
".<p>
And the rest of your HMTL message goes here..."

System.Web.Mail.SmtpMail.SmtpServer = "your.smtp.server"
System.Web.Mail.SmtpMail.Send(mail)
End While

End Sub
</script>
<html>
<head>
</head>
<body>
</body>
</html>

When you open that page, an email with the contents you specify
will be sent to every email address in the Email column in the Users
table in your SQL Server Database.


Juan T. Llibre
ASP.NET MVP
http://asp.net.do/foros/
Foros de ASP.NET en Español
Ven, y hablemos de ASP.NET...
======================

"Eduardo Rosa" <ed*****@clas.com.br> wrote in message
news:ub**************@TK2MSFTNGP12.phx.gbl... ok then...
I wrote queue not for ornament, because I've work a lot with ASP and it need
third-party component to do that.
I was hurry and maybe should wrote the word in uppercase because what I
found in google it most 3rd-party too. So I'll ask again, most precise ok
Juan?

A loop with a many e-mail list works in ASP.Net, unlike classic ASP?
Somebody know how I queue e-mail in ASP.Net without 3rd-party component?
"Juan T. Llibre" <no***********@nowhere.com> escreveu na mensagem
news:eV**************@TK2MSFTNGP14.phx.gbl...
Somebody doesn't know how to Google.
That has got to be the most-often-answered question here.

http://www.google.com/search?as_q=as...h=&safe=images

Juan T. Llibre
ASP.NET MVP
http://asp.net.do/foros/
Foros de ASP.NET en Español
Ven, y hablemos de ASP.NET...
======================

"Eduardo Rosa" <ed*****@clas.com.br> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
Somebody knows how I queue email using .Net?

thanks a lot

Nov 19 '05 #6
I don't think like that: if I can make that runs faster why let the user sit
front the machine waiting... With a bad server it could take more then 10
min.
That alread happened to me, the server was bad and the list was big
(newsletter for a portal), I don't know how much sending email was improved
in ASP.Net, maybe that works (I'll try) but I doubt...

thanks a lot


"Juan T. Llibre" <no***********@nowhere.com> escreveu na mensagem
news:eY*************@TK2MSFTNGP15.phx.gbl...
re:
if that number e-mails are big the script can execed the timeout


You can increase the timeout, so that the page has time to complete.
Check web.config's <httpRuntime executionTimeout="90" ... />

and set it to however long you need.

Juan T. Llibre
ASP.NET MVP
http://asp.net.do/foros/
Foros de ASP.NET en Español
Ven, y hablemos de ASP.NET...
======================

"Eduardo Rosa" <ed*****@clas.com.br> wrote in message
news:uP**************@TK2MSFTNGP10.phx.gbl...
Using classic ASP that page will execute until all e-mail had be sended,
if that number e-mails are big the script can execed the timeout, some
components give to server manage the e-mail sendind, so the script runs
fast. My doubt is: some class in default .Net library can do that or I
need a 3rd party?

exemple of components for classic ASP

AspQMail (http://www.serverobjects.com/comp/AspQMail.htm)

ASPEmail (www.persits.com), por exemplo o o método queue:
Enables message queuing.
False by default. If set to True, specifies that a subsequent call to
Send will place the message in a message queue to be processed by
EmailAgent.
This is a premium feature.
thanks a lot Juan

"Juan T. Llibre" <no***********@nowhere.com> escreveu na mensagem
news:eG**************@tk2msftngp13.phx.gbl...
Eduardo,

when you say "queue", do you mean getting a list of email
addresses from a database and sending emails to all of them ?

If so, here's a sample :

<%@ Page Language="VB" %>
<%@ import Namespace="System.Data" %>
<%@ import Namespace="System.Web.Mail" %>
<script runat="server">

Sub Page_Load(Src as object, E as EventArgs)

Dim P, U, Em As String
Dim connectionString As String = "server='YourSQLServerName';
trusted_connection=true; database='YourSQLServerDatabase"
Dim dbConnection As IDbConnection = New
SqlClient.SqlConnection(connectionString)

Dim queryString As String = "SELECT UserName, Password, Email FROM Users"
Dim dbCommand As IDbCommand = New SqlClient.SqlCommand
dbCommand.CommandText = queryString
dbCommand.Connection = dbConnection

dbConnection.Open
Dim dataReader As IDataReader =
dbCommand.ExecuteReader(CommandBehavior.CloseConne ction)

While dataReader.Read()
U = dataReader("Username").ToString()
P = dataReader("Password").ToString()
Em = dataReader("Email").ToString()

' Build a MailMessage
Dim mail As System.Web.Mail.MailMessage = New System.Web.Mail.MailMessage
mail.From = "yo******@yourmailserver.com"
mail.To = Em
mail.Subject = "Your Email's subject."
mail.BodyFormat = System.Web.Mail.MailFormat.Html

mail.Body="Hello, " & U & ".<p>Your Username is " & U & " and your
password is " & P & ".<p>
And the rest of your HMTL message goes here..."

System.Web.Mail.SmtpMail.SmtpServer = "your.smtp.server"
System.Web.Mail.SmtpMail.Send(mail)
End While

End Sub
</script>
<html>
<head>
</head>
<body>
</body>
</html>

When you open that page, an email with the contents you specify
will be sent to every email address in the Email column in the Users
table in your SQL Server Database.


Juan T. Llibre
ASP.NET MVP
http://asp.net.do/foros/
Foros de ASP.NET en Español
Ven, y hablemos de ASP.NET...
======================

"Eduardo Rosa" <ed*****@clas.com.br> wrote in message
news:ub**************@TK2MSFTNGP12.phx.gbl...
> ok then...
> I wrote queue not for ornament, because I've work a lot with ASP and it

need
> third-party component to do that.
> I was hurry and maybe should wrote the word in uppercase because what I
> found in google it most 3rd-party too. So I'll ask again, most precise

ok
> Juan?
>
> A loop with a many e-mail list works in ASP.Net, unlike classic ASP?
> Somebody know how I queue e-mail in ASP.Net without 3rd-party

component?
>
>
> "Juan T. Llibre" <no***********@nowhere.com> escreveu na mensagem
> news:eV**************@TK2MSFTNGP14.phx.gbl...
>> Somebody doesn't know how to Google.
>> That has got to be the most-often-answered question here.
>>
>> http://www.google.com/search?as_q=as...h=&safe=images >>
>>
>>
>>
>> Juan T. Llibre
>> ASP.NET MVP
>> http://asp.net.do/foros/
>> Foros de ASP.NET en Español
>> Ven, y hablemos de ASP.NET...
>> ======================
>>
>> "Eduardo Rosa" <ed*****@clas.com.br> wrote in message
>> news:%2****************@tk2msftngp13.phx.gbl...
>>> Somebody knows how I queue email using .Net?
>>>
>>> thanks a lot


Nov 19 '05 #7

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

Similar topics

3
by: Paul Lamonby | last post by:
Hi, I am sending a file from the server as an email attachment. The file is being attached no problem and sending the email, but I get an error when I try to open it saying it is corrupt....
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...
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: Ant | last post by:
Hi, I'm using the MailMessage & smtpMail classes in System.Web.Mail to send mail, however it's not sending any emails. I'm using it on a Windows 2003 server. The simplest way to use this is...
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: =?Utf-8?B?QWRl?= | last post by:
HI All, I am encountering the following error when I try to send an email through a SMTP server. I believe the problem lies with the authentication part when the network crednetials are used,...
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...
7
by: bleachie | last post by:
Hey, I just need some help, my form seems to not send me all of the 'guestNames' and 'guestEmails' forms. i use this function to add more guestnames and guestemail fields based on the number of...
10
by: Markgoldin | last post by:
I am sending an XML data from not dontnet process to a .Net via socket listener. Here is a data sample: <VFPData> <serverdata> <coderun>updateFloor</coderun> <area>MD2</area>...
31
by: happyse27 | last post by:
Hi All, I am trying for weeks how to send email from windows pc, which from my gmail account to my hotmail account. Using net::smtp module sending email failed,Kindly assist. (for the item d it...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 4 Oct 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
4
NeoPa
by: NeoPa | last post by:
Hello everyone. I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report). I know it can be done by selecting :...
3
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be using a very simple database which has Form (clsForm) & Report (clsReport) classes that simply handle making the calling Form invisible until the Form, or all...
1
by: Teri B | last post by:
Hi, I have created a sub-form Roles. In my course form the user selects the roles assigned to the course. 0ne-to-many. One course many roles. Then I created a report based on the Course form and...
3
by: nia12 | last post by:
Hi there, I am very new to Access so apologies if any of this is obvious/not clear. I am creating a data collection tool for health care employees to complete. It consists of a number of...
0
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...
0
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...
4
by: GKJR | last post by:
Does anyone have a recommendation to build a standalone application to replace an Access database? I have my bookkeeping software I developed in Access that I would like to make available to other...

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.