List Info

Thread: Email code working fine in debug mode...not when uploaded




Email code working fine in debug mode...not when uploaded
country flaguser name
United States
2007-07-17 08:26:32
Hi,

I know this is not the correct forum to post this... but i
am doing so
coz i need the solution fast!


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

Is there any solution to it? thanks in advance 

Is it a problem with the guys who host my website?
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("sndgmail.com",
"rcvdomain.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("sndgmail.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;
        }
    }

---------------


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "ASP.Net Community" group.
To post to this group, send email to aspnetgooglegroups.com
To unsubscribe from this group, send email to
aspnet-unsubscribegooglegroups.com
For more options, visit this group at http://gr
oups.google.com/group/aspnet?hl=en
-~----------~----~----~----~------~----~------~--~---


Re: Email code working fine in debug mode...not when uploaded
country flaguser name
United States
2007-07-22 22:27:01
I would say more than likely your app is being blocked by a
firewall
when trying to connectto port 587 from the remote web
server.  Use
try.. catch blocks to pin point where the error is coming
from.  This
is assuming that normal pages load correctly on the server.
On Jul 17, 9:26 am, ".spider"
<krishna.aat...gmail.com> wrote:
> Hi,
>
> I know this is not the correct forum to post this...
but i am doing so
> coz i need the solution fast!
>
> This code emails the contents of 'TextBox1' and
'TextBox3' to
> r...domain.com.. this code seemed to be working fine in
debug mode and
> DID mail r...domain.com However when i uploaded the
website to my
> hosting account, my browser popped up and alertbox
saying:
>
"Sys.WebForms.PageRequestServerManagerErrorException An
unknown error
> occured while processing the request on the server. The
status code
> returned from the server was : 500"
>
> Is there any solution to it? thanks in advance 
>
> Is it a problem with the guys who host my website?
> 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("s...gmail.com", "r...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("s...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;
>         }
>     }
>
> ---------------


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "ASP.Net Community" group.
To post to this group, send email to aspnetgooglegroups.com
To unsubscribe from this group, send email to
aspnet-unsubscribegooglegroups.com
For more options, visit this group at http://gr
oups.google.com/group/aspnet?hl=en
-~----------~----~----~----~------~----~------~--~---


[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )