473,785 Members | 2,619 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

StmpClient does not seems to use NetworkCredenti al

Guy
I use SmtpClient to send mail. My customer reported that sending mail
was throwing an exception on his machine "the SMPT client requires a
secure connection or the client was not authenticated".

so I now provide credentials with my request, however it sends mail
all the time, whichever username or password I use. I even removed the
password from my Outlook account options. Sends mail anyway ?

Is there a credential cache in Windows taking effect ?

cred = new NetworkCredenti al(strUserName, strPassword);

smtp = new SmtpClient();
smtp.Host = strMailHost;
smtp.UseDefault Credentials = false;
smtp.Credential s = cred;

May 27 '07 #1
1 7638
Probably TLS/SSL needed:

string from = "me@example.com ";
string to = "yo*@example.co m";
string username = "username";
string password = "password";

System.Net.Mail .MailMessage email = new
System.Net.Mail .MailMessage(fr om, to);
email.Body = "Hi";
System.Net.Mail .SmtpClient mailClient = new
System.Net.Mail .SmtpClient();
System.Net.Netw orkCredential basicAuthentica tionInfo = new
System.Net.Netw orkCredential(u sername, password);
mailClient.Host = "smtp.example.c om";
mailClient.Port = 587; //preferred port for sending SMTP
messages (if it doesn't work just remove this line)
mailClient.Enab leSsl = true; //!!!!!important! !!!!!!!
mailClient.UseD efaultCredentia ls = true;
mailClient.Cred entials = basicAuthentica tionInfo;
mailClient.Send (email);

Miroslav Stampar MCSD, Security+
http://mstampar.awardspace.com

Guy je napisao/la:
I use SmtpClient to send mail. My customer reported that sending mail
was throwing an exception on his machine "the SMPT client requires a
secure connection or the client was not authenticated".

so I now provide credentials with my request, however it sends mail
all the time, whichever username or password I use. I even removed the
password from my Outlook account options. Sends mail anyway ?

Is there a credential cache in Windows taking effect ?

cred = new NetworkCredenti al(strUserName, strPassword);

smtp = new SmtpClient();
smtp.Host = strMailHost;
smtp.UseDefault Credentials = false;
smtp.Credential s = cred;
May 27 '07 #2

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

Similar topics

0
1152
by: Eddie Lipshultz | last post by:
I'm working with the NetworkCredential class. I'm making the correct call and it returns that everything is okay using: NetworkCredential sc = new NetworkCredential("MyAccount", sPassword, myURL); However, I then need to make a call using HTTPS to a URL which changes the password. For example:
2
19068
by: Prathiraj | last post by:
Hi All, I'm trying to access a web page from C# code. Since I'm behind a firewall/proxy, I creat a webproxy and NetworkCredential to access the web page. It works fine. In this way, I have to give the username and password for creating the NetworkCredential object. Is there anyway that I can get the NetworkCredential object from the logged on user?
0
1444
by: Ivan G. | last post by:
Hi. I'm trying to call web service passing a new System.Net.NetworkCredential to it's reference: jobs.Jobs j = new jobs.Jobs(); j.Credentials = new System.Net.NetworkCredential(login,password,domain); but anyway I get System.SecurityException
3
2046
by: Justin Dutoit | last post by:
Hey. I have the error CS0117 'BusinessLayer' does not contain a definition for 'MySoapHeader'. Below is a link to the asmx source, and the code which calls the web service. MS seems to do the same thing at http://www.dotnetjunkies.com/QuickStart/aspplus/default.aspx?url=/quickstart /aspplus/doc/secureservices.aspx I'd appreciate any help. Thanks Justin Dutoit
3
6933
by: Patrick Fogarty | last post by:
I am programming what is to be a web service client that will use an HTTP-POST to request and retrieve data. The remote server (written in java for what it's worth) requires basic authentication as per RFC 2617 (http://www.faqs.org/rfcs/rfc2617.html). My attempts to authenticate are failing. The server requires the header to be present with the request. For security reasons, it will not reply in any way if the header is not present. ...
0
1173
by: steve | last post by:
Hi We have an application that send webRequests to a server using a specified user accounts. These requests will often be for different users. The problem we have is that the webRequest, even though it is a fresh object that is disposed of, will always use the first newtowrkCredntial we specify. We are NOT using credentialCache as we dont want to cache the credentials. Anyone know why this is and how to prevent / workaround this?
2
2969
by: YK | last post by:
Hi I have a Web Application that connects to Exchange WebDAV using a class that I found on http://www.codeproject.com/dotnet/exdav.asp. This class requires a NetworkCredential object in order to authenticate the HTTP request against the Exchange server, and since that my WebApp is configured in the IIS to use ONLY Integrated Windows Authentication I have the Windows identity object from which I can get only the user name. Is there a...
1
5140
by: dlutz | last post by:
Hello to all -- I am familiar with Xml in general and NET 1.1 Xml, but I am new to the ..NET 2.0 changes in System.Xml. I am trying to validate an XML document that is based on a schema that imports several other schemas. I am using VS2005 and .NET 2.0 on Windows 2003 Server with SP1. I am using the Validate method of the XmlDocument class. I am passing in an instance of XmlReader.
3
6768
by: antonyliu2002 | last post by:
I have a website (call it WinAuthWeb) that uses Integrated Windows Authentication. In my ASP.NET web application, I collect user name, password and domain info and pass them to WinAuthWeb for authentication (formerly known as NTLM). I construct the user credentials like this: theUserCredential = New NetworkCredential(username, userpassword,
0
9645
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9481
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10155
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10095
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9953
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8978
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7502
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5383
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
3655
muto222
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.