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

Unable to dispatch E-mails...

I am new to ASP.NET (only coded web pages in HTML in the past), and I'm
having some trouble: I have a form on which a visitor to my page can
fill out comments and send them to my E-mail box. The code works fine
when I test it on my local machine; but for the identical code deployed
to my web site (hosted on GoDaddy.com), when I click the "Submit" button
to send the E-mail, an exception is thrown containing the following
error:

Request for the permission of type 'System.Net.Mail.SmtpPermission,
System, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089' failed.

I don't have the slightest idea when this means. I'm using the Express
version of VS 2008, so I cannot remotely debug the code. Does anyone
have any idea what's wrong? Here are the relevant code snippets:

Contact.aspx
---------------------
<table cellspacing="0" cellpadding="5" bgcolor="#ffe0c0">
<tbody>
<!-- (Other fields for E-mail address, etc. not shown) -->
<tr>
<td align="right">
<font face="Arial">&nbsp;Write your message
here:font>
</td>
<td>
<asp:TextBox id="TB_EmailBody" runat="server"
Font-Names="Arial" Width="400px"
TextMode="MultiLine" Height="100px" Rows="5">
</asp:TextBox>
<asp:RequiredFieldValidator ID="RFV_EmailBody"
runat="server"
ControlToValidate="TB_EmailBody"
SetFocusOnError="true" />
</td>
</tr>
<tr>
<td align="center">
<asp:Button id="SubmitButton"
OnClick="SendFeedbackEmail" runat="server"
Text="Submit"
Style="z-index: 100; left: -35px; position:
relative; top: 0px" Width="150px" />
</td>
</tr>

<tr>
<td colspan="2">
<asp:Label ID="MessageLabel" runat="server"
Style="z-index: 100; left: 0px; position: relative;
top: 0px" Text="">
</asp:Label>
</td>
</tr>
</tbody>
</table>
Contact.aspx.cs (* = omitted private info)
-----------------------------------------------------
// Create and Send E-mail based on user input
//
protected void SendFeedbackEmail(object sender, EventArgs e)
{
const string DaveName = "Dave Hardenbrook",
DaveAddy = "*****@*****.com";
const string password = "*****************";

try
{
SmtpClient smtpc =
new SmtpClient("smtpout.secureserver.net", 80);

MailMessage mmsg = new MailMessage();

// Create E-mail address objects, sender and recipient (= Dave)
//
MailAddress FromAddy = new MailAddress(TB_EmailFrom.Text,
TB_Name.Text);
//
MailAddress ToAddy = new MailAddress(DaveAddy, DaveName);

// Set E-mail Message params
//
mmsg.From = FromAddy;
mmsg.To.Add(ToAddy);
mmsg.Subject = TB_EmailSubject.Text;
mmsg.Body = TB_EmailBody.Text;

// Set SMTP Credentials
//
smtpc.Credentials =
new System.Net.NetworkCredential(DaveAddy, password);

// Dispatch E-mail
//
smtpc.Send(mmsg);

// Print result
//
MessageLabel.Text = "Sent!";
}
catch (Exception ex)
{
// Display Error
//
MessageLabel.Text = "Couldn't send E-mail: " + ex.Message;
}
}
Dec 9 '07 #1
7 1544
>SmtpClient smtpc = new SmtpClient("smtpout.secureserver.net", 80);
do you really want this on port 80? try 25 and report back ...

"Dave Hardenbrook" <da*****@gmail.comwrote in message
news:MP************************@news.west.earthlin k.net...
>I am new to ASP.NET (only coded web pages in HTML in the past), and I'm
having some trouble: I have a form on which a visitor to my page can
fill out comments and send them to my E-mail box. The code works fine
when I test it on my local machine; but for the identical code deployed
to my web site (hosted on GoDaddy.com), when I click the "Submit" button
to send the E-mail, an exception is thrown containing the following
error:

Request for the permission of type 'System.Net.Mail.SmtpPermission,
System, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089' failed.

I don't have the slightest idea when this means. I'm using the Express
version of VS 2008, so I cannot remotely debug the code. Does anyone
have any idea what's wrong? Here are the relevant code snippets:

Contact.aspx
---------------------
<table cellspacing="0" cellpadding="5" bgcolor="#ffe0c0">
<tbody>
<!-- (Other fields for E-mail address, etc. not shown) -->
<tr>
<td align="right">
<font face="Arial">&nbsp;Write your message
here:font>
</td>
<td>
<asp:TextBox id="TB_EmailBody" runat="server"
Font-Names="Arial" Width="400px"
TextMode="MultiLine" Height="100px" Rows="5">
</asp:TextBox>
<asp:RequiredFieldValidator ID="RFV_EmailBody"
runat="server"
ControlToValidate="TB_EmailBody"
SetFocusOnError="true" />
</td>
</tr>
<tr>
<td align="center">
<asp:Button id="SubmitButton"
OnClick="SendFeedbackEmail" runat="server"
Text="Submit"
Style="z-index: 100; left: -35px; position:
relative; top: 0px" Width="150px" />
</td>
</tr>

<tr>
<td colspan="2">
<asp:Label ID="MessageLabel" runat="server"
Style="z-index: 100; left: 0px; position: relative;
top: 0px" Text="">
</asp:Label>
</td>
</tr>
</tbody>
</table>
Contact.aspx.cs (* = omitted private info)
-----------------------------------------------------
// Create and Send E-mail based on user input
//
protected void SendFeedbackEmail(object sender, EventArgs e)
{
const string DaveName = "Dave Hardenbrook",
DaveAddy = "*****@*****.com";
const string password = "*****************";

try
{
SmtpClient smtpc =
new SmtpClient("smtpout.secureserver.net", 80);

MailMessage mmsg = new MailMessage();

// Create E-mail address objects, sender and recipient (= Dave)
//
MailAddress FromAddy = new MailAddress(TB_EmailFrom.Text,
TB_Name.Text);
//
MailAddress ToAddy = new MailAddress(DaveAddy, DaveName);

// Set E-mail Message params
//
mmsg.From = FromAddy;
mmsg.To.Add(ToAddy);
mmsg.Subject = TB_EmailSubject.Text;
mmsg.Body = TB_EmailBody.Text;

// Set SMTP Credentials
//
smtpc.Credentials =
new System.Net.NetworkCredential(DaveAddy, password);

// Dispatch E-mail
//
smtpc.Send(mmsg);

// Print result
//
MessageLabel.Text = "Sent!";
}
catch (Exception ex)
{
// Display Error
//
MessageLabel.Text = "Couldn't send E-mail: " + ex.Message;
}
}


Dec 9 '07 #2

"Barrie Wilson" <bw*****@nowhere.comwrote in message
news:13************@corp.supernews.com...
>
>>SmtpClient smtpc = new SmtpClient("smtpout.secureserver.net", 80);

do you really want this on port 80? try 25 and report back ...
or maybe the server is listening on port 465 if it's secure ...

OR maybe that server just won't relay mail from a GoDaddy-hosted site ...
"Dave Hardenbrook" <da*****@gmail.comwrote in message
news:MP************************@news.west.earthlin k.net...
>>I am new to ASP.NET (only coded web pages in HTML in the past), and I'm
having some trouble: I have a form on which a visitor to my page can
fill out comments and send them to my E-mail box. The code works fine
when I test it on my local machine; but for the identical code deployed
to my web site (hosted on GoDaddy.com), when I click the "Submit" button
to send the E-mail, an exception is thrown containing the following
error:

Request for the permission of type 'System.Net.Mail.SmtpPermission,
System, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089' failed.

I don't have the slightest idea when this means. I'm using the Express
version of VS 2008, so I cannot remotely debug the code. Does anyone
have any idea what's wrong? Here are the relevant code snippets:

Contact.aspx
---------------------
<table cellspacing="0" cellpadding="5" bgcolor="#ffe0c0">
<tbody>
<!-- (Other fields for E-mail address, etc. not shown) -->
<tr>
<td align="right">
<font face="Arial">&nbsp;Write your message
here:font>
</td>
<td>
<asp:TextBox id="TB_EmailBody" runat="server"
Font-Names="Arial" Width="400px"
TextMode="MultiLine" Height="100px" Rows="5">
</asp:TextBox>
<asp:RequiredFieldValidator ID="RFV_EmailBody"
runat="server"
ControlToValidate="TB_EmailBody"
SetFocusOnError="true" />
</td>
</tr>
<tr>
<td align="center">
<asp:Button id="SubmitButton"
OnClick="SendFeedbackEmail" runat="server"
Text="Submit"
Style="z-index: 100; left: -35px; position:
relative; top: 0px" Width="150px" />
</td>
</tr>

<tr>
<td colspan="2">
<asp:Label ID="MessageLabel" runat="server"
Style="z-index: 100; left: 0px; position: relative;
top: 0px" Text="">
</asp:Label>
</td>
</tr>
</tbody>
</table>
Contact.aspx.cs (* = omitted private info)
-----------------------------------------------------
// Create and Send E-mail based on user input
//
protected void SendFeedbackEmail(object sender, EventArgs e)
{
const string DaveName = "Dave Hardenbrook",
DaveAddy = "*****@*****.com";
const string password = "*****************";

try
{
SmtpClient smtpc =
new SmtpClient("smtpout.secureserver.net", 80);

MailMessage mmsg = new MailMessage();

// Create E-mail address objects, sender and recipient (= Dave)
//
MailAddress FromAddy = new MailAddress(TB_EmailFrom.Text,
TB_Name.Text);
//
MailAddress ToAddy = new MailAddress(DaveAddy, DaveName);

// Set E-mail Message params
//
mmsg.From = FromAddy;
mmsg.To.Add(ToAddy);
mmsg.Subject = TB_EmailSubject.Text;
mmsg.Body = TB_EmailBody.Text;

// Set SMTP Credentials
//
smtpc.Credentials =
new System.Net.NetworkCredential(DaveAddy, password);

// Dispatch E-mail
//
smtpc.Send(mmsg);

// Print result
//
MessageLabel.Text = "Sent!";
}
catch (Exception ex)
{
// Display Error
//
MessageLabel.Text = "Couldn't send E-mail: " + ex.Message;
}
}



Dec 9 '07 #3
See if this thread helps:

Problem with System.Net.Mail on GoDaddy
http://forums.asp.net/t/939893.aspx

--
Eliyahu Goldin,
Software Developer
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
http://usableasp.net
"Dave Hardenbrook" <da*****@gmail.comwrote in message
news:MP************************@news.west.earthlin k.net...
>I am new to ASP.NET (only coded web pages in HTML in the past), and I'm
having some trouble: I have a form on which a visitor to my page can
fill out comments and send them to my E-mail box. The code works fine
when I test it on my local machine; but for the identical code deployed
to my web site (hosted on GoDaddy.com), when I click the "Submit" button
to send the E-mail, an exception is thrown containing the following
error:

Request for the permission of type 'System.Net.Mail.SmtpPermission,
System, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089' failed.

I don't have the slightest idea when this means. I'm using the Express
version of VS 2008, so I cannot remotely debug the code. Does anyone
have any idea what's wrong? Here are the relevant code snippets:

Contact.aspx
---------------------
<table cellspacing="0" cellpadding="5" bgcolor="#ffe0c0">
<tbody>
<!-- (Other fields for E-mail address, etc. not shown) -->
<tr>
<td align="right">
<font face="Arial">&nbsp;Write your message
here:font>
</td>
<td>
<asp:TextBox id="TB_EmailBody" runat="server"
Font-Names="Arial" Width="400px"
TextMode="MultiLine" Height="100px" Rows="5">
</asp:TextBox>
<asp:RequiredFieldValidator ID="RFV_EmailBody"
runat="server"
ControlToValidate="TB_EmailBody"
SetFocusOnError="true" />
</td>
</tr>
<tr>
<td align="center">
<asp:Button id="SubmitButton"
OnClick="SendFeedbackEmail" runat="server"
Text="Submit"
Style="z-index: 100; left: -35px; position:
relative; top: 0px" Width="150px" />
</td>
</tr>

<tr>
<td colspan="2">
<asp:Label ID="MessageLabel" runat="server"
Style="z-index: 100; left: 0px; position: relative;
top: 0px" Text="">
</asp:Label>
</td>
</tr>
</tbody>
</table>
Contact.aspx.cs (* = omitted private info)
-----------------------------------------------------
// Create and Send E-mail based on user input
//
protected void SendFeedbackEmail(object sender, EventArgs e)
{
const string DaveName = "Dave Hardenbrook",
DaveAddy = "*****@*****.com";
const string password = "*****************";

try
{
SmtpClient smtpc =
new SmtpClient("smtpout.secureserver.net", 80);

MailMessage mmsg = new MailMessage();

// Create E-mail address objects, sender and recipient (= Dave)
//
MailAddress FromAddy = new MailAddress(TB_EmailFrom.Text,
TB_Name.Text);
//
MailAddress ToAddy = new MailAddress(DaveAddy, DaveName);

// Set E-mail Message params
//
mmsg.From = FromAddy;
mmsg.To.Add(ToAddy);
mmsg.Subject = TB_EmailSubject.Text;
mmsg.Body = TB_EmailBody.Text;

// Set SMTP Credentials
//
smtpc.Credentials =
new System.Net.NetworkCredential(DaveAddy, password);

// Dispatch E-mail
//
smtpc.Send(mmsg);

// Print result
//
MessageLabel.Text = "Sent!";
}
catch (Exception ex)
{
// Display Error
//
MessageLabel.Text = "Couldn't send E-mail: " + ex.Message;
}
}


Dec 9 '07 #4
"Eliyahu Goldin" <RE**************************@mMvVpPsS.orgwrote in
message news:uy**************@TK2MSFTNGP03.phx.gbl...
Problem with System.Net.Mail on GoDaddy
http://forums.asp.net/t/939893.aspx
Yet another reason to avoid them like the plague...
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Dec 9 '07 #5
re:
!Problem with System.Net.Mail on GoDaddy

That was the coder's problem, not GoDaddy's.
He was using the wrong smtp server...and the wrong port, to boot.

The coder posted the solution to his mistake in the same thread.

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/
======================================
"Mark Rae [MVP]" <ma**@markNOSPAMrae.netwrote in message news:Ou**************@TK2MSFTNGP06.phx.gbl...
"Eliyahu Goldin" <RE**************************@mMvVpPsS.orgwrote in message
news:uy**************@TK2MSFTNGP03.phx.gbl...
>Problem with System.Net.Mail on GoDaddy
http://forums.asp.net/t/939893.aspx

Yet another reason to avoid them like the plague...
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Dec 9 '07 #6
"Juan T. Llibre" <no***********@nowhere.comwrote in message
news:u4**************@TK2MSFTNGP06.phx.gbl...
re:
!Problem with System.Net.Mail on GoDaddy

That was the coder's problem, not GoDaddy's.
He was using the wrong smtp server...and the wrong port, to boot.

The coder posted the solution to his mistake in the same thread.
Apologies - you're quite right, and I didn't read the entire post...

Still wouldn't go anywhere near them, though...
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Dec 9 '07 #7
In article <uy**************@TK2MSFTNGP03.phx.gbl>,
RE**************************@mMvVpPsS.org says...
See if this thread helps:

Problem with System.Net.Mail on GoDaddy
http://forums.asp.net/t/939893.aspx
Thanks -- Changing the server and port to what they recommend in that
thread seems to have solved the problem.
Dave
Dec 11 '07 #8

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

Similar topics

3
by: RJ | last post by:
Hi, I've been going over the Quick Start to Client side COM and Python and many other sources, but cannot find an example that will get my com/ActiveX .ocx USB device driver imported. The Excel...
2
by: Carlos G Benevides | last post by:
I have a ASP.Net web application that has two assemblies that run under com+. Under Windows 2000 the two assemblies are added to com+ automatically when instantiated from the web site. For this...
3
by: Dan Vogel | last post by:
I'd like to find an elegant solution to the problem of calling a certain function based on the types of two parameters. In my case, the functions compute the distance between different types of...
3
by: muttu2244 | last post by:
Hi all Am trying to read an html page using win32com in the following way. from win32com.client import Dispatch ie = Dispatch("InternetExplorer.Application")
3
by: tyler.schlosser | last post by:
Hi there, I am trying to launch a program called AmiBroker using the command: AB = win32com.client.Dispatch("Broker.Application") However, I have a dual-core CPU and would like to launch two...
4
by: mirandacascade | last post by:
O/S : Win2K vsn of Python: 2.4 Hoping to find information that provide information about error messages being encountered. Pythonwin session: Traceback (most recent call last): File...
2
by: jiccab | last post by:
Greetings. with the following code, olApp = Dispatch("Outlook.Application") I am capable of getting a new instance of Outlook running. I would like to be able to use the instance that is...
5
by: markww | last post by:
Hi, Can someone explain to me what static and dynamic dispatch are and what the difference is between the two? Do this even occurr in C++? Thanks
4
by: vithi | last post by:
Hi' I am trying to launch an application. When I try like that When I try like that Excel is opening import win32com.client object = win32com.client.Dispatch("Excel.Application") object.Visible...
3
by: Tigera | last post by:
Greetings, I too have succumbed to the perhaps foolish urge to write a video game, and I have been struggling with the implementation of multiple dispatch. I read through "More Effective C++"...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.