Home > failure sending > failure sending email error in asp.net

Failure Sending Email Error In Asp.net

here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up C# - Failure sending mail up vote 2 down vote favorite This code works fine on my local machine ut when I deploy it. it gives Failure sending mail error.. Please Help... MailAddress addrsTo = new MailAddress(toEmail); MailAddress addrsFrom = new MailAddress("XXX@XXX.com", "XXX Title"); MailMessage mailmsg = new MailMessage(addrsFrom, addrsTo); mailmsg.Subject = mailSbjct; mailmsg.Body = "XXX Body"; SmtpClient smtp = new SmtpClient("mail.XXX.com"); smtp.EnableSsl = false; smtp.Port = 26; smtp.Credentials = new NetworkCredential("XXX@XXX.com", "XXXXXXX"); try { smtp.Send(mailmsg); } catch (Exception exc) { throw new XXXException(1234, "---" + exc.Message); } c# asp.net .net share|improve this question edited Mar 21 '13 at 7:03 Anujith 8,10362241 asked Mar 21 '13 at 6:41 Arahim 881413 There may be a network problem, could you control your firewall settings and enable your firewall for your specific application? –AngelinaJolly Mar 21 '13 at 6:44 1 what error you are getting? If your deployed machine have connection with mail client. –sharafjaffri Mar 21 '13 at 6:46 It gives me just "Failure sending mail". –Arahim Mar 21 '13 at 7:54 Check your ports on the remote machine. Standard SMTP port is 25 and your code is using 26. It may be possible that it’s blocked by firewall or something. –David Smithers Mar 21 '13 at 10:30 you have not accepted the answer, hope its working. –Arshad Mar 22 '13 at 14:55 add a comment| 2 Answers 2 active oldest votes up vote 7 down vote accepted you can try this, if you are using gmail : MailMessage mail = new MailMessage(); mail.Subject = "Your Subject"; mail.From = new MailAddress("senderMailAddress"); mail.To.Add("ReceiverMailAddress"); mail.Body = "Hello! your mail content goes here..."; mail.IsBodyHtml = true; SmtpClient smtp = new SmtpClient("smtp.gmail.com", 587); smtp.EnableSsl = true; NetworkCredential netCre = new NetworkCredential("SenderMailAddress","SenderPassword" ); smtp.Credentials = netCre; try { smtp.Send(mail); } catch (Exception ex) { } share|improve this answer answered Mar 21 '13 at 6:49

Tips/Tricks Top Articles Beginner Articles Technical Blogs Posting/Update Guidelines Article Help Forum Article Competition Submit an article or tip Post your Blog quick answersQ&A Ask a Question View Unanswered Questions View All Questions... C# questions Linux questions ASP.NET questions SQL questions VB.NET questions discussionsforums All Message Boards... Application Lifecycle> Running a Business Sales / Marketing Collaboration / Beta Testing Work Issues Design and Architecture ASP.NET JavaScript C / C++ / MFC> ATL / WTL / STL Managed C++/CLI C# Free Tools Objective-C and Swift Database Hardware & Devices> System Admin Hosting and Servers Java .NET Framework Android iOS Mobile SharePoint Silverlight / WPF Visual Basic Web Development Site http://stackoverflow.com/questions/15541045/c-sharp-failure-sending-mail Bugs / Suggestions Spam and Abuse Watch features Competitions News The Insider Newsletter The Daily Build Newsletter Newsletter archive Surveys Product Showcase Research Library CodeProject Stuff communitylounge Who's Who Most Valuable Professionals The Lounge   The Insider News The Weird & The Wonderful The Soapbox Press Releases Non-English Language > General Indian Topics General Chinese Topics help What is 'CodeProject'? General FAQ Ask a Question Bugs and Suggestions Article Help Forum http://www.codeproject.com/Questions/105973/Failure-sending-mail-error-in-asp-net Site Map Advertise with us About our Advertising Employment Opportunities About Us Ask a Question All Questions All Unanswered FAQ Failure sending mail. error in asp .net Rate this: Please Sign up or sign in to vote. See more: ASP.NET Hi, I have used gmail for sending mail localy which worked fine but when i uploaded the same file on server the "Failure sending mail." error occured. Here is the code that I have written: Dim message As New MailMessage message.From = New MailAddress("xxx@gmail.com") message.To.Add(New MailAddress("xxx@yahoo.com")) message.Subject = test mail"" message.Body = "Hi you have got a test mail from me!" Dim client As New SmtpClient client.Credentials = New System.Net.NetworkCredential("xxx@gmail.com", "xxxxxxx") client.Port = 587 client.Host = "smtp.gmail.com" client.EnableSsl = True client.Send(message) Please help me! Posted 30-Aug-10 19:47pm Sunil Tarwara232 Updated 31-Aug-10 7:45am Sandeep Mewara505.4K v3 Add a Solution Comments senguptaamlan 31-Aug-10 1:56am go through the stack trace of the error and if possible post the same here S M P 31-Aug-10 10:03am Please write your code in code block 5 solutions Top Rated Most Recent Rate this: Please Sign up or sign in to vote. Solution 1 Accept Solution Reject Solution If it works on your local machine and not on the server, then the server cannot access

360 games PC games https://support.microsoft.com/en-us/kb/2183292 Windows games Windows phone games Entertainment All Entertainment Movies & TV Music Business & Education Business Students & educators http://forums.asp.net/t/1552582.aspx?+Failure+sending+mail+error Developers Sale Sale Find a store Gift cards Products Software & services Windows Office Free downloads & security Internet failure sending Explorer Microsoft Edge Skype OneNote OneDrive Microsoft Health MSN Bing Microsoft Groove Microsoft Movies & TV Devices & Xbox All Microsoft devices Microsoft Surface All Windows PCs & tablets PC accessories Xbox & games Microsoft Lumia All failure sending email Windows phones Microsoft HoloLens For business Cloud Platform Microsoft Azure Microsoft Dynamics Windows for business Office for business Skype for business Surface for business Enterprise solutions Small business solutions Find a solutions provider Volume Licensing For developers & IT pros Develop Windows apps Microsoft Azure MSDN TechNet Visual Studio For students & educators Office for students OneNote in classroom Shop PCs & tablets perfect for students Microsoft in Education Support Sign in Cart Cart Javascript is disabled Please enable javascript and refresh the page Cookies are disabled Please enable cookies and refresh the page CV: {{ getCv() }} English (United States)‎ Terms of use Privacy & cookies Trademarks © 2016 Microsoft

ASP.NET Community Standup Forums Help Home/ASP.NET Forums/General ASP.NET/Web Forms/"Failure sending mail." error "Failure sending mail." error [Answered]RSS 2 replies Last post May 03, 2010 01:30 AM by Hua-Jun Li - MSFT ‹ Previous Thread|Next Thread › Print Share Twitter Facebook Email Shortcuts Active Threads Unanswered Threads Unresolved Threads Support Options Advanced Search Related Links GuidanceSamplesVideos Reply svibuk Member 151 Points 1921 Posts "Failure sending mail." error Apr 29, 2010 03:35 AM|svibuk|LINK i am using a email function & call it in the page when need to send email by passing the parameters needed i have this function calledon submit button butthe code is inline ie in .aspx in

 

© Copyright 2019|winbytes.org.