Connecting Tech Pros Worldwide Forums | Help | Site Map

Sending Email

Leonard
Guest
 
Posts: n/a
#1: Oct 12 '05
I have a requirement, where a user will click on a button, and the Email new
message window will open up. The app will fill in the To: column from a
database.

I have gotten it to work, by using

Dim sEmail As String = "mailto:"
sEmail = sEmail & _
"user1@some.com;user2@some.com"
HttpContext.Current.Response.Redirect(sEmail)

However, the web browser then gets a page cannot be displayed error. How do
I open the new mail window?

I also have the same issue with other web pages. How can I dynamically open
a web page in a new browser window?


Venkat_KL
Guest
 
Posts: n/a
#2: Oct 12 '05

re: Sending Email


Hi Dear Leonard,

You can send the fill in the To: column filled up from the database to a
new webpage in several ways
I will show you two ways.

1. Using QueryString - If the sEmail is not a secret data.
2. Using the Session - If the sEmail is a secret data.

for both the ways build the sEmail as you have shown (but you have not
showing filling from the database. But anyway, that you can do it)

Dim sEmail As String = "mailto:"
sEmail = sEmail & _
"user1@some.com;user2@some.com"

''To Send the QueryString to the Second form
''===========================


HttpContext.Current.Response.Redirect(WebForm2.asp x?mailtoaddress_QueryString=" + sEmail)

mailtoaddress_QueryString - change this name as per your requirement.

Whatever you send through sEmail will get attached to the Redirect URL as a
QueryString

To use the QueryString in the Second form
============================
I have show populating in the TextBox and Lable, or using in Response.Write.
You can use as you like

TextBox1.Text=Request.QueryString["mailtoaddress_QueryString"].ToString()
Label1.Text=Request.QueryString["mailtoaddress_QueryString"].ToString()

Response.Write("<b><Font color=blue>Mail to Address Using
QueryString:</Font></b>" +Request.QueryString["mailtoaddress_QueryString"])

************************************************** **********

II Way - Using Session
====
In the 1st WebPage
============

Dim sEmail As String = "mailto:"
sEmail = sEmail & _
"user1@some.com;user2@some.com"

Session["mailtoaddress"]=sEmail;

In the 2nd WebPage
=============

TextBox1.Text=Session["mailtoaddress"]).ToString()

Label1.Text=Session["mailtoaddress"]).ToString()

Response.Write("<b><Font color=blue>Mail to Address Using
QueryString:</Font></b>" + Session["mailtoaddress"])

For Anything and Everything, please let me know

bye
Venkat_KL


Leonard
Guest
 
Posts: n/a
#3: Oct 12 '05

re: Sending Email



But how do I open the 2nd web page in a different browser?

"Venkat_KL" wrote:
[color=blue]
> Hi Dear Leonard,
>
> You can send the fill in the To: column filled up from the database to a
> new webpage in several ways
> I will show you two ways.
>
> 1. Using QueryString - If the sEmail is not a secret data.
> 2. Using the Session - If the sEmail is a secret data.
>
> for both the ways build the sEmail as you have shown (but you have not
> showing filling from the database. But anyway, that you can do it)
>
> Dim sEmail As String = "mailto:"
> sEmail = sEmail & _
> "user1@some.com;user2@some.com"
>
> ''To Send the QueryString to the Second form
> ''===========================
>
>
> HttpContext.Current.Response.Redirect(WebForm2.asp x?mailtoaddress_QueryString=" + sEmail)
>
> mailtoaddress_QueryString - change this name as per your requirement.
>
> Whatever you send through sEmail will get attached to the Redirect URL as a
> QueryString
>
> To use the QueryString in the Second form
> ============================
> I have show populating in the TextBox and Lable, or using in Response.Write.
> You can use as you like
>
> TextBox1.Text=Request.QueryString["mailtoaddress_QueryString"].ToString()
> Label1.Text=Request.QueryString["mailtoaddress_QueryString"].ToString()
>
> Response.Write("<b><Font color=blue>Mail to Address Using
> QueryString:</Font></b>" +Request.QueryString["mailtoaddress_QueryString"])
>
> ************************************************** **********
>
> II Way - Using Session
> ====
> In the 1st WebPage
> ============
>
> Dim sEmail As String = "mailto:"
> sEmail = sEmail & _
> "user1@some.com;user2@some.com"
>
> Session["mailtoaddress"]=sEmail;
>
> In the 2nd WebPage
> =============
>
> TextBox1.Text=Session["mailtoaddress"]).ToString()
>
> Label1.Text=Session["mailtoaddress"]).ToString()
>
> Response.Write("<b><Font color=blue>Mail to Address Using
> QueryString:</Font></b>" + Session["mailtoaddress"])
>
> For Anything and Everything, please let me know
>
> bye
> Venkat_KL
>
>[/color]
Closed Thread