473,473 Members | 2,164 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

new link

I have made a small form to send the mail to the websmaster, but i
don;t know how to code this action:

if the mail was sent successfully, than go to the url www.xxxyyyzzz.com

Thanks
Vinnie

Oct 6 '07 #1
5 1436
"Vinnie" <ce**********@gmail.comwrote in message
news:11**********************@y42g2000hsy.googlegr oups.com...
>I have made a small form to send the mail to the websmaster, but i
don;t know how to code this action:

if the mail was sent successfully, than go to the url www.xxxyyyzzz.com
Slightly modified from:
http://msdn2.microsoft.com/en-us/lib...wc(vs.80).aspx

public static void CreateTestMessage(string server)
{
try
{
string to = "ja**@contoso.com";
string from = "be*@contoso.com";
MailMessage message = new MailMessage(from, to);
message.Subject = "Using the new SMTP client.";
message.Body = "Hello";
SmtpClient client = new SmtpClient(server);
client.Send(message);
Response.Redirect("www.xxxyyyzzz.com", false);
}
catch (Exception ex)
{
// do something
}
}
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Oct 6 '07 #2
Slightly modified from:http://msdn2.microsoft.com/en-us/lib...wc(vs.80).aspx
>
public static void CreateTestMessage(string server)
{
try
{
string to = "j...@contoso.com";
string from = "b...@contoso.com";
MailMessage message = new MailMessage(from, to);
message.Subject = "Using the new SMTP client.";
message.Body = "Hello";
SmtpClient client = new SmtpClient(server);
client.Send(message);
Response.Redirect("www.xxxyyyzzz.com", false);
}
catch (Exception ex)
{
// do something
}

}

--
Mark Rae
ASP.NET MVPhttp://www.markrae.net
hi Mark, taanks a lot.

I have modified the code in this way, do you think it will work? I
have this concerns:
a) is the conversion that i placed in the TO and FROM, in the right
way?
b) in the catch function, what code should be placed?

Oct 6 '07 #3
"Vinnie" <ce**********@gmail.comwrote in message
news:11**********************@y42g2000hsy.googlegr oups.com...
>public static void CreateTestMessage(string server)
{
try
{
string to = "j...@contoso.com";
string from = "b...@contoso.com";
MailMessage message = new MailMessage(from, to);
message.Subject = "Using the new SMTP client.";
message.Body = "Hello";
SmtpClient client = new SmtpClient(server);
client.Send(message);
Response.Redirect("www.xxxyyyzzz.com", false);
}
catch (Exception ex)
{
// do something
}

}
I have modified the code in this way, do you think it will work? I
have this concerns:
a) is the conversion that i placed in the TO and FROM, in the right
way?
Only if there is really an email address "j...@contosom.com", which seems
unlikely...
b) in the catch function, what code should be placed?
Depends how you're doing your exception handling... If you don't need to
handle the expection in this code, it will bubble up to the calling
method...
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Oct 6 '07 #4
On Oct 6, 7:22 pm, "Mark Rae [MVP]" <m...@markNOSPAMrae.netwrote:
a) is the conversion that i placed in the TO and FROM, in the right
way?

Only if there is really an email address "j...@contosom.com", which seems
unlikely...
b) in the catch function, what code should be placed?

Depends how you're doing your exception handling... If you don't need to
handle the expection in this code, it will bubble up to the calling
method...

--
Mark Rae
ASP.NET MVPhttp://www.markrae.net
I got this error msg, what's about?

CS0246: The type or namespace name 'MailMessage' could not be found
(are you missing a using directive or an assembly reference?)

Oct 6 '07 #5
"Vinnie" <ce**********@gmail.comwrote in message
news:11**********************@k79g2000hse.googlegr oups.com...
I got this error msg, what's about?

CS0246: The type or namespace name 'MailMessage' could not be found
(are you missing a using directive or an assembly reference?)
It means you haven't included System.Net at the top of your class:
http://www.systemnetmail.com/
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Oct 7 '07 #6

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

Similar topics

3
by: Matt Adams | last post by:
As well known I could specify the text color in the body tag like: <BODY TEXT=WHITE LINK=WHITE VLINK=RED ALINK=WHITE> What I want to achieve now is that always (!) the text of the last visited...
26
by: Harrie | last post by:
Hi, After Brian mentioned the use for <link rel=..> for navigational purposes in another thread, I've been looking into it and found that HTML 3.2 has two other recognized link types than HTML...
4
by: Franklin | last post by:
WITHOUT KNOWING ANYTHING ABOUT THE CURRENT COLORS, I want to swap the foreground/background colors of a link when someone hovers over it. Is this possible with HTML, CSS, DOM, & JavaScript? If...
8
by: sudhirlko2001 | last post by:
How to swap two nodes of doubly Linklist
14
by: Steve McLellan | last post by:
Hi, Sorry to repost, but this is becoming aggravating, and causing me a lot of wasted time. I've got a reasonably large mixed C++ project, and after a number of builds (but not a constant...
1
by: sri2097 | last post by:
Hi all, I have written a Link list implementation in Python (Although it's not needed with Lists and Dictionaries present. I tried it just for the kicks !). Anyway here is the code - # Creating...
8
by: Steve | last post by:
Hi; I had a big link checking job to do and it has been years since I have done anything like that so I found a test page to use that I knew had bad links on it( a friends site ) and I decided...
7
by: gehegeradeaus | last post by:
Can someone help me to make a regular expression for this sort of replacement : text with {link:pagehref}a link{/link}. replace to -> text with <a href="pagehref">a link</a> I tried...
7
by: Kurda Yon | last post by:
Hi everybody, I cannot understand the following thinks. The last line of the fillowing code produces a message about mistake (not a valid MySQL- Link resource): $link = mysql_connect(...
4
by: perryche | last post by:
Is this possible? Instead of using the link wizard, can the FE/BE link be established any other way that users can simply type the link path? Thanks, Perry
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.