Working with System.Web.Mail but not with System.Net.Mail

Hi, i am having trouble sending e-mails using System.Net.Mail namespace while there is no problem with System.Web.Mail. I am  using remote smtp server with no authentication.  My code as shown below:

1    try
2 {
3 MailMessage message = new MailMessage();
4 message.BodyFormat = MailFormat.Html;
5 message.To = "admin@mydomain.com";
6 message.From = "test@mydomain.com";
7 message.Subject = "Test Smtp";
8 message.Body = "TestMail 123";
9
10 SmtpMail.SmtpServer = "mail.mysmtpserver";
11 SmtpMail.Send(message);
12 Lbl1.Text += "Mail Sent Successfully!";
13 }
14 catch (Exception ex)
15 {
16 Lbl1.Text += ex.Message;
17 }
18
19 try
20 {
21 System.Net.Mail.MailMessage message = new System.Net.Mail.MailMessage("test@mydomain.com", "admin@mydomain.com", "Test Subject", "Test 123 Content");
22 System.Net.Mail.SmtpClient mailClient = new System.Net.Mail.SmtpClient("mail.mysmtpserver");
23 mailClient.Send(message);
24 Lbl2.Text += "Mail Sent Successfully!";
25 }
26 catch (Exception ex)
27 {
28 Exception ex2 = ex;
29
30 while (ex2 != null)
31 {
32 Lbl2.Text += ex2.ToString();
33 ex2 = ex2.InnerException;
34 }
35
36 }

Error message from System.Net.Mail block:

System.Net.Mail.SmtpException: Command not implemented. The server response was: 5.5.1 Sorry, we do not support this operation at System.Net.Mail.SmtpConnection.GetConnection(String host, Int32 port) at System.Net.Mail.SmtpTransport.GetConnection(String host, Int32 port) at System.Net.Mail.SmtpClient.GetConnection() at System.Net.Mail.SmtpClient.Send(MailMessage message) at TestMail.Page_Load(Object sender, EventArgs e)

Can anyone help please ?
0
habibs
5/9/2006 12:27:17 PM
asp.net.web-forms 93655 articles. 6 followers. Follow

1 Replies
1289 Views

Similar Articles

[PageSpeed] 39
Get it on Google Play
Get it on Apple App Store

Did you try and leave the SmtpMail.SmtpServer blank? We work off a remote server. Do you have a relay setup with an exchange server?

SmtpMail.SmtpServer = "";


- km
______________________________________
"always here and always forever"
0
griff303
5/9/2006 1:22:21 PM
Reply:

Similar Artilces:

Help for Visual web dev isolate system.web.mail to system.net.mail
Hi all,  I'm new user to visual web developer express software. Laterly i found this application isolate quite some of the component namespace, like system.web.mail to net.mail. I not well understand how system.net.mail functional?? Does it act same as system.web.mail?? My coding below: change system.web.mail to system.net.mail which causing a lot error... *****Can anybody correct me or advise me how to make this code work in system.net.mail?????? <%@import Namespace="System.net.Mail" %> <script runat="server">    Public FromAddress As String = "" .......

System.web.mail to System.net.mail
I converted a asp.net web app from VS 2003 to VS 2005. i now get error message when i build it  stating system.web.mail  is obsolute,  use system.net.mail i redefine to system.net.mail but now i get other error message such as smtpMail does not exist in the current context. cannot implicitly convert type string to System.Net.Mail.MailAddress   so System.Web.Mail want work in ASP.net web app convert to VS 2005 running on framework 2.0?           because if i change to System.Net.Mail  i am ...

Migrating from System.web.mail to System.net.mail
Hi Every1,I've recently used the System.web.mail to send mail, using the IIS's smtp server.Doing this, i didn't really need to do anything in the web.config file or give any special parameters to the client. It just assumed i was working with my very own smtp service that came with the IIS and everything worked fine.Now i migrated to System.net.mail and now i need to insert my smtp service's host location under <system.net> in the web.config file.However, i don't know what to write there so the client will use my smtp sevice (host="localhost" doesn't work)can any1 help me on this one?t...

difference between System.Web.Mail and System.Net.Mail
What is difference between System.Web.Mail and System.Net.Mail  namespace?What is use of both ? System.Web.Mail was in .NET Framework v1.1System.Net.Mail is in .NET Framework v2.0 and greaterSame use, although there is more functionality in System.Net.Mail since it is a later version of the framework. Darrell Norton, MVPDarrell Norton's BlogPlease mark this post as answered if it helped you!  What All-Star said. I assume the reason it was moved to a different namespace is because the internet is actually a suite of technologies: e-mail, ftp, http (web), etc. E-mail and...

switching from system.web.mail to system.net.mail
I have been converting my code from system.web.mail to system.net.mail.  I have been able to convert the to, from, cc, and message body to the new format easily but...my question is how do i convert this into system.net.mail format?SmtpMail.SmtpServer = "server";                SmtpMail.Send(mail);Would this be the solution?SmtpClient client = new SmtpClient("server");                client.Send(mail); Here's a full example of how to per...

System.Web.Mail vs System.Net.Mail
Hi AllI was using System.Web.Mail in an application on our test server.  That worked fine.  I never had to specify a server or change any settings.  It just works.  Whatever settings the server has set up are used.  This is great.I saw that System.Web.Mail has been deprecated, so I'm trying to use System.Net.Mail.  I'm having a problem.  Net.Mail doesn't use whatever settings Web.Mail used.  I can't send e-mail with Net.Mail.  I see several people use the web.config file to set the server up, but I can't get that to work. I jus...

Changing System.Web.Mail to System.Net.Mail
I am trying to learn ASPI have been using the Visual Web Developer 2005I have the following line that I can not work out how to convert.<%Dim FromForm As String = "Mail@Myname.co.uk"Dim ToMe As String = "Me@myname.co.uk"Dim FormSubject As String = "Contact Infomation"Dim EmailText As String = "Blar Blar Blar"System.Web.Mail.SmtpMail.Send(FromForm,ToMe,FormSubject,EmailText)%>It tells me that I cannot use System.Web.Mail any more and should use System.Net.Mail. I have been unable to work out what the new code should be to get it to work.The Language is VBCan anyone tell me how to change...

Converting from System.Web.Mail to System.Net.Mail
Hi there, I'm from Argentina. I've converted System.Web.Mail (code is underlined) to System.Net.Mail (code is Bold) . I'd like to know if it's correct. Thanks !!public uint enviar()        {            try            {                // Abrir el archivo que contiene el template del HTML.                // Envia el mail con el HTML.&nbs...

What additional advantage we get through System.net.mail over the old system.web.mail?
What additional advantage we get through System.net.mail over the old system.web.mail?Is it needed to configure the smtp server? Plz tell me the steps to develop the email sending facility in our applicationSwati Jain Take a look at www.systemnetmail.com.JeffPlease: Don't forget to click "Mark as Answer" on the post that helped you. That way future readers will know which post solved your issue....

Problem with difference between System.Web.Mail and System.Net.Mail in using attachments
I have a web .Net app which sends emails with attachments.  After the email is sent I clean up aftermyself and delete the attachments from disk.   In upgrading to .Net 2  I changed the email logic from using system.web.mail to system.net.mail  (of course vs is telling me system.web.mail is obsolete).In .Net 1.1,  the files deleted with no problem but in .Net 2 when I attempt to delete  I receive The process cannot access the file ...' because it is being used by another process. If I change the code back to using system.web.mail I can delete the file...

System.Web.Mail.MailMessage.UrlContentBase in System.Net...
Is there an equivalent of UrlContentBase and UrlContentLocation in System.Net.*??The views, opinions, and judgments expressed in this message are solely those of the author. The message contents have not been reviewed or approved by Convergence Communications Consultants....

Value of type 'System.Net.Mail.MailMessage' cannot be converted to 'System.Net.Mail.AlternateView'
Trying to create an alternateview to send a txt email with the html formatted email.  I've used string builder to create the whole email, but I get this error.  Any ideas why?  i've bolded the line that throws the error... Dim EmailBodyTxt As New StringBuilder EmailBodyTxt.Append("<html><style type='text/css'>.table{border:solid; border-color:#006666; width:600;} ")EmailBodyTxt.Append("<body><table class='table'><tr><td colspan='2'><h1>Test<br />RESPONSE SYSTEM</h1></td>...

System.Net.Mail is giving error CS0029: Cannot implicitly convert type 'string' to 'System.Net.Mail.MailAddress'
I'm getting an error while trying to use the wizard to create a form and than pass it the vaibles to Mail. Any help would be much appreciated. SmtpClient smtpClient = new SmtpClient(); MailMessage message = new MailMessage(); try {   message.From = txtEmail.Text; message.To.Add("admin1@yoursite.com"); message.Subject = "Feedback"; message.CC.Add("admin1@yoursite.com"); message.CC.Add("admin2@yoursite.com"); message.IsBodyHtml = false; message.Body = txtMessage.Text; smtpClient.Send(message); lblStatus.Text = "Email successfully sent."; } catch (Exception ex) { lbl...

Aspose.Email 1.1 Released!
Aspose.Email 1.1 Released! Version 1.1.0 Released on January 25 2005 ...

Web resources about - Working with System.Web.Mail but not with System.Net.Mail - asp.net.web-forms

Working class - Wikipedia, the free encyclopedia
Working class (or lower class , labouring class, sometimes proletariat ) is a term used in the social sciences and in ordinary conversation to ...

This Is How Facebook Is Working to Improve Experience On Slower Connections
... outlined how it is trying to build out the world’s largest social network, while still keeping emerging markets in mind. Facebook is working ...

Apple rumored to be working on its own GPU
It's no secret that Apple prefers to own and control as much of the underlying technologies in its products as possible. The number of examples ...

My Career Left No Room For Motherhood. Now I Advocate For Working Moms
... slap of discrimination by excelling in the traditionally male occupation of law. Boy oh boy, was I wrong. I had made the transition to working ...

Paid-Off Conservatives Are Already Working To Scuttle The Climate Change Agreement Can Bernie And Raul ...
The Paris climate talks just wrapped with a historic agreement between 195 nations. But if you thought the unanimity addressing climate change ...

comedian Brian Posehn working on "full metal" LP for Megaforce w/ Scott Ian, Gary Holt, Kim Thayil & ...
Comedian and serious metalhead Brian Posehn is apparently hard at work on a new metal/comedy album, following up his albums Fart and Wiener Jokes ...

Here's how to turn your iPhone into a working scale
It's now possible to turn your new iPhone's screen into a working scale that will measure up to 385 grams (over 13 ounces and slightly less than ...

The answer to working from the beach?
For anyone who's ever toyed with the idea of being a freelancer, CNBC speaks with two successful freelancers who've been there and done that. ...

Crave Ep. 228: Working mini Death Star destroys things quite well
A laser artist shows off his latest creation, threatening mini worlds across the universe.

AT&T and Verizon both working on sponsored data offers
The nation's two biggest wireless carriers, AT&T and Verizon Wireless, have entered another competitive arena, this time over so-called "sponsored ...

Resources last updated: 12/15/2015 4:57:03 PM