Problem in sending email through my application

my code

protected void btnSubmit_Click(object sender, EventArgs e)
 {
  try
  {

   MailMessage message = new MailMessage(txtFrom.Text, txtTo.Text, txtSubject.Text, txtBody.Text);
   SmtpClient emailClient = new SmtpClient(txtSMTPServer.Text);
   emailClient.Send(message);
   litStatus.Text = "Message Sent";

  }
  catch (Exception ex)
  {
   litStatus.Text=ex.ToString();
  }
 }


and an exception occurred

System.Net.Mail.SmtpException: The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.7.0 Must issue a STARTTLS command first. m28sm28731279poh.25 at System.Net.Mail.MailCommand.CheckResponse(SmtpStatusCode statusCode, String response) at System.Net.Mail.MailCommand.Send(SmtpConnection conn, Byte[] command, String from) at System.Net.Mail.SmtpTransport.SendMail(MailAddress sender, MailAddressCollection recipients, String deliveryNotify, SmtpFailedRecipientException& exception) at System.Net.Mail.SmtpClient.Send(MailMessage message) at _Default.btnSubmit_Click(Object sender, EventArgs e)
0
chourasia
1/27/2009 6:05:09 PM
asp.net.security 27051 articles. 1 followers. Follow

3 Replies
725 Views

Similar Articles

[PageSpeed] 59

chourasia.rahul:
an exception occurred System.Net.Mail.SmtpException: The SMTP server requires a secure connection or the client was not authenticated.
 

As the error message indicated you would need to provide the credentials to access this smtp server

http://www.systemnetmail.com/faq/4.2.aspx


Kumar Reddi
0
Kumar
1/27/2009 6:25:47 PM
How can i Attach more than one file
0
chourasia
1/27/2009 8:43:46 PM

chourasia.rahul,

Please open a new thread if its a different question. that way you get better attention on the problem . Just for this time.. here is an example with multiple attachments

http://www.codeproject.com/KB/aspnet/ASPNETwebmail.aspx


Kumar Reddi
0
Kumar
1/27/2009 8:52:36 PM
Reply:

Similar Artilces:

Sending an Email with system.net.mail -- problem with strings and body of the email.
Hi,I am trying to email the contents of a contact form such that the email body looks like this:Last name: Smith First name: John Comment: Test comment. I am using the MailMessage object.I am storing the textbox values in strings://assign values from form to variables   string first = textboxFirst.Text;   string last = textboxLast.Text;   string comment = textboxComment.Text;and then combining the strings into one string for my MaiMessage.Body property.  //create message body from textbox variables     string message = "Last Name: "  + l...

Email Sending Problem in .Net
I am using asp.net for sending mail.Code is:- Dim message As New MailMessage() message.To.Add(New MailAddress(abc@yahoo.com)) message.From = New MailAddress(xyz@yahoo.com)  message.Body = txtMessage.Text message.Subject = txtSubject.Text.Trim() Dim attach As Attachment = New Attachment(txtAttache.Text) message.Attachments.Add(attach) message.Body = txtMessage.Text message.IsBodyHtml = True Dim client As New SmtpClient("127.0.0.1") //Server IP client.Send(message) MessageBox.Show("MAIL SENT SUCCESSFULLY")  It works fine. But if some-one uses ...

how to send email in as.net application
hi,  please help with  my code.i'm trying to send email from my asp.net application. the code i have written is given below.there is no error,but email couldnt be send. .................................................................................................................................................. using System.Web.Mail; public partial class _Default : System.Web.UI.Page {protected MailAttachment MAtt; protected MailMessage MMsg;protected void Page_Load(object sender, EventArgs e) { }protected void btnSend_Click(object sender, EventArgs e) { /...

A problem to send email using Smtp
I have a proble to send an email from asp.net I do the following code to send an email: MailMessage mail=new MailMessage(); mail.From="test@server.com"; mail.To="myemailaddress@server.com"; mail.BodyFormat=MailFormat.Html; mail.Subject="testing..."; mail.Body="cool"; SmtpMail.SmtpServer="localhost"; SmtpMail.Send(mail); But I dont' receive an email when I use this method. Why is that? How can I send an email? Thanks in advance! check and see if.. -your client-side code has no errors -you imported the S...

Problems sending an email in VB.NET
I'm writing a program to send an email internally. Here is the code I've got: Dim Smtp As SmtpMail Smtp.SmtpServer = "mail.co.navajo.az.us" Dim Msg As MailMessage = New MailMessage Msg.To = "james.williams@co.navajo.az.us" Msg.From = "james.williams@co.navajo.az.us" Msg.Body = "This is a test email." Msg.Subject = "New Record(s)" Smtp.Send(Msg) I'm getting an exception thrown at the Smtp.Send(Msg) line and can't figure out exactly why. Here's the exception message that I get: An unhandled exception o...

Problem sending email with .net 2.0
I'm trying to send mail using the system.net.mail namespace. in the aspx file, I'm using a formview and inserting whatever is entered into a database also, then on the OnItemInserted event of the FormView, I'm trying to send the mail using the following. Can mail not be sent this way, or do you see something I could be missing?  Thanks, Rich  protected void FormContactUsFormView_Inserted(object sender, FormViewInsertedEventArgs e) { if (!Page.IsPostBack) { // send contact email //SmtpClient mySmtpClient = new SmtpClient(); ...

send email through smtp in c#.net application
Hi please tell me how to send email through smtp.   Thanks, swapprose. ASP.NET 1.1 www.systemwebmail.cim   ASP.NET 2.0 www.systemnetmail.com   HTHRegardsASP.NET Hosting (HostingFest)...

Send email using VB.NET windows Application
hi... I have created a windows Application using vb.net,to send emails when click on button.And i am having error when running the application on the server machine. Using this code: TryDim email As New System.Web.Mail.MailMessageemail.To = "tomail"email.From = "frommail"email.Body = "MessageText"email.Subject = "SubjectText"email.BodyFormat = Web.Mail.MailFormat.TextSmtpMail.SmtpServer = "MU-WEBDEV"SmtpMail.Send(email)Catch ex As ExceptionMsgBox(ex.Message)End TryI am getting the following error.An unhandled exception of type 'System.Security.SecurityException' ** i am using wi...

Send Email Problem with System.Net.Mail.SmtpPermission
Hi, My site is on a shared hosted server and a piece of code that has been working for quite a while has stopped working. I have not changed anything and my ISP (1&1) swear blind that neither have they. The following is the code that I use to send emails and also an example of the error and stack trace that I get when it is called: ------------------------------- Begin: SendEmail.vb ---------------------------------------------- Imports System Imports System.Web Imports System.Net.Mail Public Shared Sub SendEmail(ByVal ToAddr As String, ByVal FromAddr As String, ByVal Subject As St...

Problem with Web-Matrix Guided-tour Sending email with .net
Hi, I am new to VB.net, I followed the Web Matrix Project guided tour for the first few examples, they all ran well. When I start the creating a email form section, I ran into problem. 1. When I select the ASP.NET User Control template, the file extension would be ascx NOT ASPX. which one should I use? 2. When I use the ASCX file, the start button got disable. Not sure what ran wrong. 3. When I use the ASPX file, i got some directive error. Any advices would be appreciated!! Thanks Tim Hi Tim, It's most probably be a bug in the tutorial, while you may view post ...

Sending a secure email in .Net 1.1 and 3.5
Hi All,I was wondering of ways that we can secure an email being sent to clients (on internet) from our SMTP server? The email contains confidential information such as users loginID and password. Installing certs if not an option for us. So want to know any other means to send a secure email?  ThanksManju (1) Configure your SMTP server to require authentication for sending email(2) Use .NET 2.0 onwards mailing function which can impose client username and password (network credential) to send out email. Thanks for your response fatewong. But how will sending network credenti...

Sending Email Problem (always it sends)
hi all , i have this code for the send button , in my email form i have : 1- a textbox so user enter his name 2- a textbox so use put his email 3- a multiline textbox so user enter his message i have used required field validator and regular expressiona validator also but whenever a user dont enter a value , or even if he entered an invalid mail format , the mail is sent , ALTHOUGH it writes beside the textbox that this field is required and this field is invalid !! i have followed ASP.NET Guide Tour but till now no clow , strange this is the code , i need...

Retrive unread emails send by aasp.net 2.0 application
What is best way of retrieving all emails send by an asp.net 2.0 application that have not been read. The emails are managed by microsoft exchange server.--------------------------------------------------No Project Too Eazy.-------------------------------------------------- Hi Nick_Asiimwe try the following code, i haven't written this code, someone have already answered your question in forums, i copied the code from that. Dim loRequest As System.Net.HttpWebRequest Dim loResponse As System.Net.HttpWebResponse Dim loCredentials As System.Net.CredentialCache Dim lsRootUri, lsQue...

Sending Email with Net.Mail (No Email, no error)
hi,i'm using the system.net.Mail namespace to send an email from my application. when i send, the application does not fire any exception, neither does it send the email to my account.below is the code i'm using  Dim mmailMessage As New Net.Mail.MailMessage Dim mFrom As New Net.Mail.MailAddress(mailFrom) mmailMessage.From = mFrom Dim ll As String = "myname@ourmail.com" mmailMessage.To.Add(ll) mmailMessage.Subject = "Talk Concerns" mmailMessage.Body = "Testing Concerns One Two" Dim ...

Web resources about - Problem in sending email through my application - asp.net.security

Application - Wikipedia, the free encyclopedia
Text is available under the Creative Commons Attribution-ShareAlike License ;additional terms may apply. By using this site, you agree to the ...

Miller accused's bail application adjourned until Friday
One of the two men charged with causing the one-punch death of Brisbane teenager Cole Miller will stay behind bars until at least Friday.

AVO application against Labor's Jamie Clements withdrawn
An application for an apprehended violence order against Labor powerbroker Jamie Clements - based on allegations he tried to kiss a female staffer ...

Apple Stores planned for India as application is filed with regulators
... India Times , the company has recently taken a major step in accomplishing that goal. According to the report, Apple has just filed an application ...

Seagate Introduces First 8 TB Hard Disk Drive for Consumer NAS Applications
Seagate Technology on Tuesday introduced its new breed of hard disk drives (HDDs) for network area storage (NAS) and RAID applications. The new ...

MBA: Mortgage Applications Increased in Latest Weekly Survey, Purchase Applications up 17% YoY
From the MBA: Refinance Mortgage Applications Increase as Rates Fall in Latest MBA Weekly Survey Mortgage applications increased 9.0 percent ...

Mortgage applications rebound
Mortgage applications increased 21.3 percent on a seasonally adjusted basis, for the week ending January 8th, versus previous week,

SURPRISE! Mizzou Sees Application Drop After Days Of Protests, Illusory Klan Hoods, Poop Swastika
SURPRISE! Mizzou Sees Application Drop After Days Of Protests, Illusory Klan Hoods, Poop Swastika

In Application To Move To Los Angeles, Rams Shit All Over City Of St. Louis
... to relocate to the greater Los Angeles metropolitan area. The relocation would be effective for the 2016 NFL League Year.” The Rams’ full application ...

Seagate pushing non-PC storage for 2016 with focus on surveillance applications
... products for cloud computing, consumer electronics, surveillance and enterprise storage for 2016. Seagate expects surveillance-related applications ...

Resources last updated: 1/21/2016 3:01:33 PM