MailMessage Sent To Any Adress From Windows Forms Application, But Not From Asp.net Application, After Both Are Using The Same SMTP-server?
Jan 27, 2010
I'm experiencing a to me mysterious error when sending e-mails through a SMTP-server from an ASP.NET web application. I get the famous error "unable to relay for firstname.lastname@example.org". What's mysterious to me is that when I cut and paste the exact same code that sends the e-mail into an usual .NET Windows Forms application, send the e-mail with this application, it all works just fine. This made me think that perhaps the problem is that the ASP.NET application runs as NETWORK SERVICE while the Windows Forms application runs on a domain user account, but it turns out that I have another ASP.NET application sending e-mail through the same SMTP-server running under NETWORK SERVER at the same IIS, and this application does not experience this problem.
I've further tried to send e-mails through the SMTP-server manually by telnet the smtp-server on port 25 and running the SMTP-protocol manually, and it all works fine. The SMTP-server is not configured with any kind of authentication or SSL.
Another mysterious fact is that the ASP.NET application can send e-mails from an adress within the same domain to an e-mail adress within the same domain, but not to any adress outside of the domain. But the Windows Forms application, that uses the exact same code, can send e-mails from any adress to any adress both within AND outside of the domain.
So to summarize:
The ASP.NET application can send
e-mails from addresses within the
domain to adresses within the domain,
but not to addresses outside of the
A Windows Forms application running
the same code on the same computer
can send e-mails from ANY address to
Another ASP.NET application on the
same IIS running under the same
account (NETWORK SERVICE) can send
e-mails using the same SMTP-server
from ANY adress to ANY adress.
There is no authentication configured
on the SMTP-Server.
Both the ASP.NET application and the
Windows Forms application utilizes
the System.Net.Mail.SmtpClient class
to send a
The code that sends the e-mail massage is:
private void button1_Click(object sender, EventArgs e)
MailMessage mesasge = new MailMessage(txtFrom.Text, txtTo.Text, "Test mail", txtBody.Text);
SmtpClient client = new SmtpClient();
if (!(string.IsNullOrEmpty(txtUserName.Text))) //Is false since txtUserName.Text is empty
client.Credentials = new System.Net.NetworkCredential(txtUserName.Text, txtPassword.Text);
client.EnableSsl = false;
client.Host = txtServer.Text;
client.Port = 25;
catch (Exception ex)
txtResponse.Text = ex.Message;
As far as I can understand, this should be a matter of configuration rather than coding issues.
i am trying to send emails using SMTP MailMessage but i have a problems, i got the following error: Failed to send to pm@[URL] (530 5.7.0 Must issue a STARTTLS command first. g31sm24378313ibh.22 ) my code is the following:
Currently we are running an application build in VB6,ASP,Commerce Server2000 and Sql Server 2000. This application is running in Windows 2000 server.Now we are planning to migrate Windows server 2000 to Windows 2008.Will this application run in Windows 2008 or do we need to upgrade this application to dotnet and Sql 2008?
am sending email to the users using smtp client and MailMessage class.i have been adding the addresses of multiple receivers in the to property of the object of MailMessage class. the problem is that the receiver can see the email addresses of other receipents. is there any way to hide the email addresses of other receipents.i mean setting some property or something like that.otherwise i will be left with only option to send individual email to the users.
why is it that the exact same codes that i use to create a Windows application, which is able to work, does not work on a Web application? i created a windows application using c# and socket programming language. i will be connected to a remote server and through the windows application, and i will be able to send the "byte msg" to the server and activate the LED lightbulbs attached to the remote server. that exact same codes works well on the Windows application. however, when i create another Web application using the same exact codes, i does not have any error yet i am not able to activate the LED lightbulbs attached to it. is it that through the web or internet explorer i am not able to send the "byte msg" correctly? or that i sld modify "byte msg" to suit the web usage? or any other reasons?
I've got a scenario to work with. In that I've to develop a windows application. On that application when the user enters some data it should be passed to a web application(Third party) and I need to get the response from that web application or web page. The responses will be just APPROVED or DECLINED. But I've no idea how to do with this. Expecting your valuable reply. I'm developing application in .NET 4.0. Plz reply me ASAP.
I have some common dlls that are referenced by both a windows service application and a asp.net web application. I don't want to make separate copies of the dlls and I also don't want to put those dlls into GAC. I try to put that service application under the same root folder as the web application so that they can share the same bin folder. I am not quite sure if this will cause any problems? I did find the web application had random session timeout, but not very often. Not sure if it was caused by the shared dlls.
I have to write a application which connects to remote server(windows 2003 server, open SQL Management studio in that server and enter a specific SQL Server address and access a stored procedure, change some values and execute the stored procedure.)
I have to write this application using C#.Net , Could anybody point me in right direction, Where do I start?
I've developed my .net web application in Visual Studio 2005. It's been running in production on a hosted server. We recently brought in-house our own servers and configured one as a web server. I am trying to set up my web application over there and am getting your typical errors like the resource cannot be found. If you could point me to a good link, that would be great, too. I know I am having very elementary problems like creating the correct virtual directory, etc.
I'm trying to get an asp.net application up on IIS on a Windows Server 2008 machine. I can hit the app from localhost, no problem. But I can't access the app using the server's domain name either locally or from another machine on the network.But here's the odd part. I can access a normal file on IIS using the domain name, both from a browser running on the server and from a browser running on another machine on the network. Here's a synopsis ("http" converted to "htp" below because I don't have enough points to have all these links in my message):
From IE on the server itself: works htp://localhost/foo.htm works htp://localhost/App works htp://test.foo.com/foo.htm dead htp://test.foo.com/App From IE on another machine: works htp://test.foo.com/foo.htm dead htp://test.foo.com/App
I have a windows application and a web application. The windows as well as web application has a login page. The username and password are same for the windows and web application.
In the windows application, the user enters the username and password. With this username and password in windows application, is it possible to log into the web application? If yes, How to pass the data from windows application to web application, thereby logging into the web application. Is it possible to pass the username and password from a windows application to a web application?
I have a web page where I used a gridview and a button.When selecting rows in the grid and click on the button another windows application fires.I need to pass the values of the selected rows to the windows application.
Rightnow I'm saving the values in an xml file and fetch the values in the windows application.But this is not practical when creating xml files with random numbers(Scan125.xml,Scan7867.xml,etc).
I am used to working on C# .NET windows applications. I am interested in starting with web applications. good ebooks or references for C# ASP.net to begin with for a guy like me who is comfortable with windows applications?
I am getting the error -- Error 1723. There is a problem with this Windows Installer package. A DLL required for this install to complete could not be run. Contact your support personnel or package vendor. Action WEBCA_FillComboBox, entry: FillComboBox, library: C:DOCUME~1ADMINI~1.XYZLOCALS~1TempMSI15B.tmp -- when I try to deploy a ASP.NET application on the server.I am using "Enablehostheaders.js" to select the website where I need to install the files..I am using visual studio.net 2003/framework 1.1
I have built my site using VS.Net 2010 on my XP machine. I would like to deploy it to my server which is a Windows 2003 Server. I have tried to do it with FTP, but it keeps failing with the error that "Front Page Extensions are not installed on the web server". When I check the server the extensions were installed and I also checked IIS and the service for the extension is allowed.
i published an application on windows server 2008 and IIS 7 i am facing a problem when user are trying to access the server or the web application in address they put ip address of the server /application a pop up screen asking for username and password problem IIS on windows server 2008 ..the server is configured it s making me crazy it s asking users for username and password
Can anyone explain why the following happens:My ASP.NET application requires access to Application event log.When I access web application initially, it returns "Security" exception (which is expected, as I haven't granted permissions to write to Application event log yet). Then I give read/write permissions to IIS_IUSRS group on the following registry key: HKEY_LOCAL_MACHINESYSTEMCurrentControlSetserviceseventlog. As a result of this action my web application starts working.Now I remove those permissions I've granted to IIS_IUSRS group. But my web application keeps working (although I'd expect "Security" exception raised again)So, why web application keeps working, although permissions to write to Application loghave been removed?
I have IIS 7 windows server 2008 R2 64 bit on which I have few web sites which are sending emails thorugh asp.net. Each web site has seperate "From Address (used inside the code)".
In IIS 6.0 mananger >> Delivery Tab >> Out bound security >>I gave Integrated windows authentication for one account (Let us say abc).
When the emails are firing from different applications, the emails are going only if the from address is abc mentioned in the authentication. If any other email address is used then it is going to bad mail folder saying "Diagnostic-Code: smtp;550 5.7.1 Client does not have permissions to send as this sender".So to make it work I have changed the authentication to anonymous then again the emails are going to bad mail with "Diagnostic-Code: smtp;530 5.7.1 Client was not authenticated" error.
Can someone point me to a step-by-step guide on how to deploy ASP.Net applications to a totally empty and brand new Windows 2003 Server?The server has ASP.Net and the .Net framework installed on it. IIS is up and running. I have created a new application pool.
I am running a web application in vs-2008 on windows 2003 server.While execution of .net application, I am getting an error as"Unable to start debugging on the web server. Unable to connect to the web server. Verify that web server is running and that incoming HTTP requests are not blocked by firewall."
I want to execute some powershell commands on a remote windows 2008 machine. Right now i am using psexec to run the powershell from c# asp.net application. I would like to know is there any way to execute powershell commands without using a third party tool like psexec?