Failure Sending Mail Error In Vb.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 Failure sending mail Exception while sending mail through SMTP up vote 0 down vote favorite Dim mail As New Net.Mail.MailMessage() mail.From = New Net.Mail.MailAddress("abc@xyz.com") mail.[To].Add("abc@xyz.com") mail.IsBodyHtml = True mail.Subject = "A subject line." mail.Body = "A mail body message." Dim smtp As New Net.Mail.SmtpClient("smtp.xyz.com", 25) smtp.Credentials = New System.Net.NetworkCredential("abc@xyz.com","password") Try smtp.Send(mail) MsgBox("Your Email has been sent sucessfully - Thank You") Catch exc As Exception MsgBox("Send failure: " & exc.ToString()) End Try In Windows Application a simple SMTP using Credential, throwing Exception- Failure sending mail. Why it is throwing can anybody help me out. vb.net smtp windows-applications share|improve this question asked Dec 22 '14 at 9:27 Puneet_2696717 166212 2 What is in the InnerException property of the exception thrown? Furthermore, can you post the stacktrace? –Sjips Dec 22 '14 at 9:33 1 Give a look at InnerException.Message of your Exception. –tezzo Dec 22 '14 at 9:33 InnerException: InnerException = {"Unable to connect to the remote server"} –Puneet_2696717 Dec 22 '14 at 11:33 Check if your firewall blocks port 25. –Visual Vincent Dec 22 '14 at 11:49 also add the line smtp.UseDefaultCredentials = False before the try, Best make sure firewall and the exchange or isp allow mails from your ip. I know this may not be an issue but it was for me a while back. –Jonny Dec 22 '14 at 12:36 | show 1 more comment active oldest votes Know someone who can answer? Share a link to
360 games PC games Windows games Windows phone games Entertainment All Entertainment Movies & TV Music Business & Education Business Students & educators Developers Sale Sale Find a store Gift cards Products Software & services Windows Office Free downloads & security Internet http://stackoverflow.com/questions/27599838/failure-sending-mail-exception-while-sending-mail-through-smtp 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 https://support.microsoft.com/en-us/kb/2183292 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
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 http://www.codeproject.com/Questions/161678/Problem-Sending-SMTP-E-Mail-In-VB-NET 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 failure sending Visual Basic Web Development Site 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 failure sending mail Question Bugs and Suggestions Article Help Forum Site Map Advertise with us About our Advertising Employment Opportunities About Us Ask a Question All Questions All Unanswered FAQ Problem Sending SMTP E-Mail In VB.NET Rate this: Please Sign up or sign in to vote. See more: VB VB.NET Hi Guys I wrote a code to send simple E-Mail service. This code is working fine in local server to local server. But When I try to send e-mail local server to gmail, hotmail, yahoo. it is throwing below error "Mailbox name not allowed. The server response was : Sorry, relaying denied from your location" If i use Gmail, Hotmail or other ID as sender to other E-mail server it is throwing error Failure sending mail. "This code I am executing in proxy server". I have authorization for Gmail, Hotmail and yahoomail. I searched in Google but I am not get solution. This is my code Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Try Dim SmtpServer As New SmtpClient() Dim mail As New MailMessage() SmtpServer.Credentials = New Net.NetworkCredential(TxtUserName.Text, TxtPassword.Text) SmtpServer.Port = 25 '25,26,578,468 etc... SmtpServer.Host = TxtServer.Text 'mail.gmail.com mail = New MailMessage() mail.From = New MailAddress(TxtUserName.Text) mail.To.Add(TxtSender.Text) mail.Subject = "Test M