473,320 Members | 2,000 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,320 software developers and data experts.

Emailing Code works fine in debug mode, BUT NOT when uploaded

Hi,
This code emails the contents of 'TextBox1' and 'TextBox3' to
rc*@domain.com.. this code seemed to be working fine in debug mode and
DID mail rc*@domain.com However when i uploaded the website to my
hosting account, my browser popped up and alertbox saying:
"Sys.WebForms.PageRequestServerManagerErrorExcepti on An unknown error
occured while processing the request on the server. The status code
returned from the server was : 500"

CODE
----------------------------
protected void ImageButton1_Click(object sender, ImageClickEventArgs
e)
{
if (Process(TextBox1.Text) == true) //Checks if supplies
string is a valid email type or not
{ //
There was a good reason to do it server side as it was locking up
//
other controls
Label1.Text = null;
//Create Mail Message Object with content that you want to
send with mail.
System.Net.Mail.MailMessage MyMailMessage = new
System.Net.Mail.MailMessage("sn*@gmail.com", "rc*@domain.com",
"WebVisitor:" + DateTime.Now.ToString("MMMM dd yyyy"),
"email: " + TextBox1.Text + "\nquery: " + TextBox3.Text);

MyMailMessage.IsBodyHtml = false;

//Proper Authentication Details need to be passed when
sending email from gmail
System.Net.NetworkCredential mailAuthentication = new
System.Net.NetworkCredential("se**@gmail.com", "password");

//Smtp Mail server of Gmail is "smpt.gmail.com" and it
uses port no. 587
System.Net.Mail.SmtpClient mailClient = new
System.Net.Mail.SmtpClient("smtp.gmail.com", 587);

//Enable SSL
mailClient.EnableSsl = true;

mailClient.UseDefaultCredentials = false;

mailClient.Credentials = mailAuthentication;

mailClient.Send(MyMailMessage);

TextBox1.Text = null;
TextBox3.Text = null;
}
else
{
Label1.Text = "is INVALID";
TextBox1.Text = null;
}
}
----------------------------

Jul 17 '07 #1
2 1679
check that port 587 is open from your hosting server.
-- bruce (sqlwork.com)
..spider wrote:
Hi,
This code emails the contents of 'TextBox1' and 'TextBox3' to
rc*@domain.com.. this code seemed to be working fine in debug mode and
DID mail rc*@domain.com However when i uploaded the website to my
hosting account, my browser popped up and alertbox saying:
"Sys.WebForms.PageRequestServerManagerErrorExcepti on An unknown error
occured while processing the request on the server. The status code
returned from the server was : 500"

CODE
----------------------------
protected void ImageButton1_Click(object sender, ImageClickEventArgs
e)
{
if (Process(TextBox1.Text) == true) //Checks if supplies
string is a valid email type or not
{ //
There was a good reason to do it server side as it was locking up
//
other controls
Label1.Text = null;
//Create Mail Message Object with content that you want to
send with mail.
System.Net.Mail.MailMessage MyMailMessage = new
System.Net.Mail.MailMessage("sn*@gmail.com", "rc*@domain.com",
"WebVisitor:" + DateTime.Now.ToString("MMMM dd yyyy"),
"email: " + TextBox1.Text + "\nquery: " + TextBox3.Text);

MyMailMessage.IsBodyHtml = false;

//Proper Authentication Details need to be passed when
sending email from gmail
System.Net.NetworkCredential mailAuthentication = new
System.Net.NetworkCredential("se**@gmail.com", "password");

//Smtp Mail server of Gmail is "smpt.gmail.com" and it
uses port no. 587
System.Net.Mail.SmtpClient mailClient = new
System.Net.Mail.SmtpClient("smtp.gmail.com", 587);

//Enable SSL
mailClient.EnableSsl = true;

mailClient.UseDefaultCredentials = false;

mailClient.Credentials = mailAuthentication;

mailClient.Send(MyMailMessage);

TextBox1.Text = null;
TextBox3.Text = null;
}
else
{
Label1.Text = "is INVALID";
TextBox1.Text = null;
}
}
----------------------------
Jul 17 '07 #2
Try:

!System.Net.Mail.MailMessage("snd", "rc*@domain.com",

instead of
!System.Net.Mail.MailMessage("sn*@gmail.com", "rc*@domain.com",

Also, you have to setup your Gmail account for POP3 access.
There's instructions for doing that at the Gmail site.


Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
======================================
".spider" <ku**********@gmail.comwrote in message news:11**********************@z28g2000prd.googlegr oups.com...
Hi,
This code emails the contents of 'TextBox1' and 'TextBox3' to
rc*@domain.com.. this code seemed to be working fine in debug mode and
DID mail rc*@domain.com However when i uploaded the website to my
hosting account, my browser popped up and alertbox saying:
"Sys.WebForms.PageRequestServerManagerErrorExcepti on An unknown error
occured while processing the request on the server. The status code
returned from the server was : 500"

CODE
----------------------------
protected void ImageButton1_Click(object sender, ImageClickEventArgs
e)
{
if (Process(TextBox1.Text) == true) //Checks if supplies
string is a valid email type or not
{ //
There was a good reason to do it server side as it was locking up
//
other controls
Label1.Text = null;
//Create Mail Message Object with content that you want to
send with mail.
System.Net.Mail.MailMessage MyMailMessage = new
System.Net.Mail.MailMessage("sn*@gmail.com", "rc*@domain.com",
"WebVisitor:" + DateTime.Now.ToString("MMMM dd yyyy"),
"email: " + TextBox1.Text + "\nquery: " + TextBox3.Text);

MyMailMessage.IsBodyHtml = false;

//Proper Authentication Details need to be passed when
sending email from gmail
System.Net.NetworkCredential mailAuthentication = new
System.Net.NetworkCredential("se**@gmail.com", "password");

//Smtp Mail server of Gmail is "smpt.gmail.com" and it
uses port no. 587
System.Net.Mail.SmtpClient mailClient = new
System.Net.Mail.SmtpClient("smtp.gmail.com", 587);

//Enable SSL
mailClient.EnableSsl = true;

mailClient.UseDefaultCredentials = false;

mailClient.Credentials = mailAuthentication;

mailClient.Send(MyMailMessage);

TextBox1.Text = null;
TextBox3.Text = null;
}
else
{
Label1.Text = "is INVALID";
TextBox1.Text = null;
}
}
----------------------------

Jul 17 '07 #3

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

Similar topics

5
by: aaj | last post by:
Hi all I have written a small app on my machine that I have passed on to a colleague for testing. The problem is, as soon as he steps through in debug mode and reaches try { conn.Open();...
2
by: John Beschler | last post by:
I have a c# function that runs fine in VS.Net when in debug mode; however, when I switch to Relase mode or compile the app, the function fails with "object refernce not set". Here is the whole...
3
by: Andy | last post by:
Hi all, I'm having a problem doing an Xslt transform in code. I've done it before, so I'm not really sure why its not working. The problem is that the result of the transform is an empty...
3
by: Russ | last post by:
I keep getting this message "The compiler failed with error code 2000" when pressing PF5 to run Debug. This is not a compile error, it gets past the compile. I get this when it tries to load up my...
21
by: Chris Durkin | last post by:
I've got an ASP.NET website on my local box, set to compile to bin\Debug and bin\Release in debug and release modes. Both directories are populated with dlls, as the solution has been compiled in...
2
by: zubair | last post by:
Sir I have I'm given a task to debugg and add some functionlity to a big website containing hundreds of ASP.net pages, C# is the language used. Please anyone help me that: If I change the...
0
by: johnsburg | last post by:
Windows 2003 Server ..Net Studio 2003 Creating a simple Windows Form application from the templates, if I try to run it in debug mode devenv.exe aborts with this info: An unhandled exception...
1
by: Ethan Strauss | last post by:
Hi, I have a C#.net Web application which calls a web service (http://eutils.ncbi.nlm.nih.gov/entrez/eutils/soap/eutils.wsdl). It has run just fine for months. Recently I started getting...
11
by: Gord | last post by:
When I open a certain report, it runs some code that generates the records that will be displayed in that report. This works fine. When I go to print preview the report it appears that the code...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

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.