By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,098 Members | 2,007 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,098 IT Pros & Developers. It's quick & easy.

Sending Emails to Multiple Receipents and with multiple options

P: n/a
Jai
Hi,

I am in a problem of sending mass emails(newsletter) to my website
members.

Actually my problem is this:

I want to send newsletter to my website members. But I had given a
facility for each member to choose different category of products or
all products newsletter.

How can I extract all emails and category options from the database and
accordingly i want to generate a single newsletter for each member.

My ASP.NET 2.0 code:

Sub email()
Dim objDR As OleDbDataReader
Dim sEmail As String
Using connection As New
OleDbConnection(ConfigurationManager.ConnectionStr ings("Personal").ConnectionString)
Using command As New OleDbCommand("usp_GetNewsletterEmail",
connection)
Try
command.CommandType = CommandType.StoredProcedure
connection.Open()
objDR =
command.ExecuteReader(System.Data.CommandBehavior. CloseConnection)

While objDR.Read()

'create the mail message
Dim mail As New MailMessage()

'set the addresses
mail.From = New
MailAddress("my****@mysite.com")

sEmail = objDR("UserEmail")

mail.To.Add(sEmail)

'set the content
mail.Subject = "MySite: Weekly Newsletter"

'first we create the Plain Text part
Dim plainView As AlternateView =
AlternateView.CreateAlternateViewFromString("This is my plain text
content, viewable by those clients that don't support html", Nothing,
"text/plain")

'then we create the Html part
Dim htmlView As AlternateView =
AlternateView.CreateAlternateViewFromString("<b>th is is bold text, and
viewable by those mail clients that support html</b>", Nothing,
"text/html")

mail.AlternateViews.Add(plainView)
mail.AlternateViews.Add(htmlView)

'send the message
Dim smtp As New SmtpClient("127.0.0.1")
'specify the mail server address
smtp.Send(mail)

End While

Catch ex As Exception

End Try
End Using
End Using

End Sub

In the above code, I am able to extract email address of each member
but the problem is that each members has its own option for newsletter
like somebody wants to get newletter of "Hardware", and somebody else
wants "Hardware + Software + Electronics" and someother one wants "ALL
Products".................

I am storing all these options in my database against each user email
address.............

now when i am fetching emails and options(each user has its own
options) from the database...

i am able to send newsletter to each member but not with its own
options.

Please help me..........how will i be able to send newsletter to my
each members with its own options..so that the members get the email at
once....

Please tell me how the newsletter contains the images....with
scheduling(automatic emails once in a week).

With Regards,
----------
Jai

Sep 12 '06 #1
Share this Question
Share on Google+
5 Replies


P: n/a
I am not sure what is your problem?

If you need to send a separate email to each member, then do so. If you have
lot's of members, that means they all won't get the email at the exact same
instant. So what?

To make them closer together, you can construct all the email objects, but
not send them. Then loop through and actually send each one. This will make
them all be sent much closer together, since there won't be the delay of
constructing the emails in between, since you did all that up front.

"Jai" <ja***********@gmail.comwrote in message
news:11**********************@m73g2000cwd.googlegr oups.com...
Hi,

I am in a problem of sending mass emails(newsletter) to my website
members.

Actually my problem is this:

I want to send newsletter to my website members. But I had given a
facility for each member to choose different category of products or
all products newsletter.

How can I extract all emails and category options from the database and
accordingly i want to generate a single newsletter for each member.

My ASP.NET 2.0 code:

Sub email()
Dim objDR As OleDbDataReader
Dim sEmail As String
Using connection As New
OleDbConnection(ConfigurationManager.ConnectionStr ings("Personal").ConnectionString)
Using command As New OleDbCommand("usp_GetNewsletterEmail",
connection)
Try
command.CommandType = CommandType.StoredProcedure
connection.Open()
objDR =
command.ExecuteReader(System.Data.CommandBehavior. CloseConnection)

While objDR.Read()

'create the mail message
Dim mail As New MailMessage()

'set the addresses
mail.From = New
MailAddress("my****@mysite.com")

sEmail = objDR("UserEmail")

mail.To.Add(sEmail)

'set the content
mail.Subject = "MySite: Weekly Newsletter"

'first we create the Plain Text part
Dim plainView As AlternateView =
AlternateView.CreateAlternateViewFromString("This is my plain text
content, viewable by those clients that don't support html", Nothing,
"text/plain")

'then we create the Html part
Dim htmlView As AlternateView =
AlternateView.CreateAlternateViewFromString("<b>th is is bold text, and
viewable by those mail clients that support html</b>", Nothing,
"text/html")

mail.AlternateViews.Add(plainView)
mail.AlternateViews.Add(htmlView)

'send the message
Dim smtp As New SmtpClient("127.0.0.1")
'specify the mail server address
smtp.Send(mail)

End While

Catch ex As Exception

End Try
End Using
End Using

End Sub

In the above code, I am able to extract email address of each member
but the problem is that each members has its own option for newsletter
like somebody wants to get newletter of "Hardware", and somebody else
wants "Hardware + Software + Electronics" and someother one wants "ALL
Products".................

I am storing all these options in my database against each user email
address.............

now when i am fetching emails and options(each user has its own
options) from the database...

i am able to send newsletter to each member but not with its own
options.

Please help me..........how will i be able to send newsletter to my
each members with its own options..so that the members get the email at
once....

Please tell me how the newsletter contains the images....with
scheduling(automatic emails once in a week).

With Regards,
----------
Jai

Sep 12 '06 #2

P: n/a
You could see how much different set of optiosn you have so that each
variatino of the letter is created once and then sent to all those who
requested the same options...

The trivial approcahc would be jsut to create a different letter for each
user (with the drawback that if two users have the same options the letter
will be still created twice).

--
Patrice

"Jai" <ja***********@gmail.coma écrit dans le message de news:
11**********************@m73g2000cwd.googlegroups. com...
Hi,

I am in a problem of sending mass emails(newsletter) to my website
members.

Actually my problem is this:

I want to send newsletter to my website members. But I had given a
facility for each member to choose different category of products or
all products newsletter.

How can I extract all emails and category options from the database and
accordingly i want to generate a single newsletter for each member.

My ASP.NET 2.0 code:

Sub email()
Dim objDR As OleDbDataReader
Dim sEmail As String
Using connection As New
OleDbConnection(ConfigurationManager.ConnectionStr ings("Personal").ConnectionString)
Using command As New OleDbCommand("usp_GetNewsletterEmail",
connection)
Try
command.CommandType = CommandType.StoredProcedure
connection.Open()
objDR =
command.ExecuteReader(System.Data.CommandBehavior. CloseConnection)

While objDR.Read()

'create the mail message
Dim mail As New MailMessage()

'set the addresses
mail.From = New
MailAddress("my****@mysite.com")

sEmail = objDR("UserEmail")

mail.To.Add(sEmail)

'set the content
mail.Subject = "MySite: Weekly Newsletter"

'first we create the Plain Text part
Dim plainView As AlternateView =
AlternateView.CreateAlternateViewFromString("This is my plain text
content, viewable by those clients that don't support html", Nothing,
"text/plain")

'then we create the Html part
Dim htmlView As AlternateView =
AlternateView.CreateAlternateViewFromString("<b>th is is bold text, and
viewable by those mail clients that support html</b>", Nothing,
"text/html")

mail.AlternateViews.Add(plainView)
mail.AlternateViews.Add(htmlView)

'send the message
Dim smtp As New SmtpClient("127.0.0.1")
'specify the mail server address
smtp.Send(mail)

End While

Catch ex As Exception

End Try
End Using
End Using

End Sub

In the above code, I am able to extract email address of each member
but the problem is that each members has its own option for newsletter
like somebody wants to get newletter of "Hardware", and somebody else
wants "Hardware + Software + Electronics" and someother one wants "ALL
Products".................

I am storing all these options in my database against each user email
address.............

now when i am fetching emails and options(each user has its own
options) from the database...

i am able to send newsletter to each member but not with its own
options.

Please help me..........how will i be able to send newsletter to my
each members with its own options..so that the members get the email at
once....

Please tell me how the newsletter contains the images....with
scheduling(automatic emails once in a week).

With Regards,
----------
Jai

Sep 12 '06 #3

P: n/a
Jai
Hi Marina,

But how can i dynamically create a webform(newsletter) with my database
data and then send the newsletter to each member with there own
specific options........
Please provide any code for this if you can

Thanks in advance
Jai

Marina Levit [MVP] wrote:
I am not sure what is your problem?

If you need to send a separate email to each member, then do so. If you have
lot's of members, that means they all won't get the email at the exact same
instant. So what?

To make them closer together, you can construct all the email objects, but
not send them. Then loop through and actually send each one. This will make
them all be sent much closer together, since there won't be the delay of
constructing the emails in between, since you did all that up front.

"Jai" <ja***********@gmail.comwrote in message
news:11**********************@m73g2000cwd.googlegr oups.com...
Hi,

I am in a problem of sending mass emails(newsletter) to my website
members.

Actually my problem is this:

I want to send newsletter to my website members. But I had given a
facility for each member to choose different category of products or
all products newsletter.

How can I extract all emails and category options from the database and
accordingly i want to generate a single newsletter for each member.

My ASP.NET 2.0 code:

Sub email()
Dim objDR As OleDbDataReader
Dim sEmail As String
Using connection As New
OleDbConnection(ConfigurationManager.ConnectionStr ings("Personal").ConnectionString)
Using command As New OleDbCommand("usp_GetNewsletterEmail",
connection)
Try
command.CommandType = CommandType.StoredProcedure
connection.Open()
objDR =
command.ExecuteReader(System.Data.CommandBehavior. CloseConnection)

While objDR.Read()

'create the mail message
Dim mail As New MailMessage()

'set the addresses
mail.From = New
MailAddress("my****@mysite.com")

sEmail = objDR("UserEmail")

mail.To.Add(sEmail)

'set the content
mail.Subject = "MySite: Weekly Newsletter"

'first we create the Plain Text part
Dim plainView As AlternateView =
AlternateView.CreateAlternateViewFromString("This is my plain text
content, viewable by those clients that don't support html", Nothing,
"text/plain")

'then we create the Html part
Dim htmlView As AlternateView =
AlternateView.CreateAlternateViewFromString("<b>th is is bold text, and
viewable by those mail clients that support html</b>", Nothing,
"text/html")

mail.AlternateViews.Add(plainView)
mail.AlternateViews.Add(htmlView)

'send the message
Dim smtp As New SmtpClient("127.0.0.1")
'specify the mail server address
smtp.Send(mail)

End While

Catch ex As Exception

End Try
End Using
End Using

End Sub

In the above code, I am able to extract email address of each member
but the problem is that each members has its own option for newsletter
like somebody wants to get newletter of "Hardware", and somebody else
wants "Hardware + Software + Electronics" and someother one wants "ALL
Products".................

I am storing all these options in my database against each user email
address.............

now when i am fetching emails and options(each user has its own
options) from the database...

i am able to send newsletter to each member but not with its own
options.

Please help me..........how will i be able to send newsletter to my
each members with its own options..so that the members get the email at
once....

Please tell me how the newsletter contains the images....with
scheduling(automatic emails once in a week).

With Regards,
----------
Jai
Sep 12 '06 #4

P: n/a
Jai
Hi Marina,

But how can i dynamically create a webform(newsletter) with my database
data and then send the newsletter to each member with there own
specific options........
Please provide any code for this if you can

Thanks in advance
Jai

Marina Levit [MVP] wrote:
I am not sure what is your problem?

If you need to send a separate email to each member, then do so. If you have
lot's of members, that means they all won't get the email at the exact same
instant. So what?

To make them closer together, you can construct all the email objects, but
not send them. Then loop through and actually send each one. This will make
them all be sent much closer together, since there won't be the delay of
constructing the emails in between, since you did all that up front.

"Jai" <ja***********@gmail.comwrote in message
news:11**********************@m73g2000cwd.googlegr oups.com...
Hi,

I am in a problem of sending mass emails(newsletter) to my website
members.

Actually my problem is this:

I want to send newsletter to my website members. But I had given a
facility for each member to choose different category of products or
all products newsletter.

How can I extract all emails and category options from the database and
accordingly i want to generate a single newsletter for each member.

My ASP.NET 2.0 code:

Sub email()
Dim objDR As OleDbDataReader
Dim sEmail As String
Using connection As New
OleDbConnection(ConfigurationManager.ConnectionStr ings("Personal").ConnectionString)
Using command As New OleDbCommand("usp_GetNewsletterEmail",
connection)
Try
command.CommandType = CommandType.StoredProcedure
connection.Open()
objDR =
command.ExecuteReader(System.Data.CommandBehavior. CloseConnection)

While objDR.Read()

'create the mail message
Dim mail As New MailMessage()

'set the addresses
mail.From = New
MailAddress("my****@mysite.com")

sEmail = objDR("UserEmail")

mail.To.Add(sEmail)

'set the content
mail.Subject = "MySite: Weekly Newsletter"

'first we create the Plain Text part
Dim plainView As AlternateView =
AlternateView.CreateAlternateViewFromString("This is my plain text
content, viewable by those clients that don't support html", Nothing,
"text/plain")

'then we create the Html part
Dim htmlView As AlternateView =
AlternateView.CreateAlternateViewFromString("<b>th is is bold text, and
viewable by those mail clients that support html</b>", Nothing,
"text/html")

mail.AlternateViews.Add(plainView)
mail.AlternateViews.Add(htmlView)

'send the message
Dim smtp As New SmtpClient("127.0.0.1")
'specify the mail server address
smtp.Send(mail)

End While

Catch ex As Exception

End Try
End Using
End Using

End Sub

In the above code, I am able to extract email address of each member
but the problem is that each members has its own option for newsletter
like somebody wants to get newletter of "Hardware", and somebody else
wants "Hardware + Software + Electronics" and someother one wants "ALL
Products".................

I am storing all these options in my database against each user email
address.............

now when i am fetching emails and options(each user has its own
options) from the database...

i am able to send newsletter to each member but not with its own
options.

Please help me..........how will i be able to send newsletter to my
each members with its own options..so that the members get the email at
once....

Please tell me how the newsletter contains the images....with
scheduling(automatic emails once in a week).

With Regards,
----------
Jai
Sep 12 '06 #5

P: n/a
Store the user options in database fields and recall them as needed.

Juan T. Llibre, asp.net MVP
aspnetfaq.com : http://www.aspnetfaq.com/
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
===================================
"Jai" <ja***********@gmail.comwrote in message
news:11**********************@m73g2000cwd.googlegr oups.com...
Hi Marina,

But how can i dynamically create a webform(newsletter) with my database
data and then send the newsletter to each member with there own
specific options........
Please provide any code for this if you can

Thanks in advance
Jai

Marina Levit [MVP] wrote:
>I am not sure what is your problem?

If you need to send a separate email to each member, then do so. If you have
lot's of members, that means they all won't get the email at the exact same
instant. So what?

To make them closer together, you can construct all the email objects, but
not send them. Then loop through and actually send each one. This will make
them all be sent much closer together, since there won't be the delay of
constructing the emails in between, since you did all that up front.

"Jai" <ja***********@gmail.comwrote in message
news:11**********************@m73g2000cwd.googleg roups.com...
Hi,

I am in a problem of sending mass emails(newsletter) to my website
members.

Actually my problem is this:

I want to send newsletter to my website members. But I had given a
facility for each member to choose different category of products or
all products newsletter.

How can I extract all emails and category options from the database and
accordingly i want to generate a single newsletter for each member.

My ASP.NET 2.0 code:

Sub email()
Dim objDR As OleDbDataReader
Dim sEmail As String
Using connection As New
OleDbConnection(ConfigurationManager.ConnectionStr ings("Personal").ConnectionString)
Using command As New OleDbCommand("usp_GetNewsletterEmail",
connection)
Try
command.CommandType = CommandType.StoredProcedure
connection.Open()
objDR =
command.ExecuteReader(System.Data.CommandBehavior. CloseConnection)

While objDR.Read()

'create the mail message
Dim mail As New MailMessage()

'set the addresses
mail.From = New
MailAddress("my****@mysite.com")

sEmail = objDR("UserEmail")

mail.To.Add(sEmail)

'set the content
mail.Subject = "MySite: Weekly Newsletter"

'first we create the Plain Text part
Dim plainView As AlternateView =
AlternateView.CreateAlternateViewFromString("This is my plain text
content, viewable by those clients that don't support html", Nothing,
"text/plain")

'then we create the Html part
Dim htmlView As AlternateView =
AlternateView.CreateAlternateViewFromString("<b>th is is bold text, and
viewable by those mail clients that support html</b>", Nothing,
"text/html")

mail.AlternateViews.Add(plainView)
mail.AlternateViews.Add(htmlView)

'send the message
Dim smtp As New SmtpClient("127.0.0.1")
'specify the mail server address
smtp.Send(mail)

End While

Catch ex As Exception

End Try
End Using
End Using

End Sub

In the above code, I am able to extract email address of each member
but the problem is that each members has its own option for newsletter
like somebody wants to get newletter of "Hardware", and somebody else
wants "Hardware + Software + Electronics" and someother one wants "ALL
Products".................

I am storing all these options in my database against each user email
address.............

now when i am fetching emails and options(each user has its own
options) from the database...

i am able to send newsletter to each member but not with its own
options.

Please help me..........how will i be able to send newsletter to my
each members with its own options..so that the members get the email at
once....

Please tell me how the newsletter contains the images....with
scheduling(automatic emails once in a week).

With Regards,
----------
Jai

Sep 12 '06 #6

This discussion thread is closed

Replies have been disabled for this discussion.