Sending Email from my application cause an exception - c#

I have an application that send email for my issues. I use SmtpClient class for this work.
It works fine with one of my mail servers but recently I use an exchange server for sending mail.
my SendEmail method throw an exception with this message:
550 Requested action not taken: mailbox unavailable / 5.7.1 Unable to
relay
Is this problem from my application or is it for mail server configuration?
What is the solution?

Well SMTP error 550 is generically (based on a little searching) define as something like:
550 Requested actions not taken as the mail box is unavailable.
This is likely an error at the destination. Eg. a disk drive has filled up.
In your case:
550 Requested action not taken: mailbox unavailable / 5.7.1 Unable to relay
The suffix indicates:
The email is not hosted on the SMTP server you're communicating with.
That SMTP server is refusing to forward to the final destination (or another relay).
There are many possible reasons for #2 (eg. an ISP's SMTP server will only relay when sending from inside the ISP's network) but finding out which would need to get into specifics (and it could be a temporary situation like loss of connectivity). Best to talk to the administrator/support for that server.

Related

What does "Mail Enabled Sub-domain check failed" mean?

I am receiving the message "Mail Enabled Sub-domain check failed" when attempting to send emails via our internal SMTP server.
I am using the SMTP Client library in a VS2013 development environment. I've inherited the code and due to the confidential information contained in the actual configuration, unfortunately I am not at liberty to post it; but I can affirm that the settings for the SMTP Client are correct and I may be able to provide any additional information if it helps to answer the question as long as it doesn't require confidential data.
In past configurations, I have always authenticated directly to a specifically named SMTP server by providing the host and port information in the SMTPClient class instantiation.
This scenario is somewhat different because I've been informed that one of our other servers (A Web Server) where the application is running; is actually being passed as the SMTP Host for the SMTP Client connection.
But in actuality, I'd say it would technically be functioning as a Relay Server since it isn't an SMTP server.
Messages are submitted to our internal staff from the clients through a Popup Dialog that allows them to enter their message and click submit. The message gets sent to an internal email address and CC'd to the sender.
Upon debugging the program, no errors get thrown on the Send() method of the client.
I've tested this and the message must be hitting the SMTP server because I do get an email; however, instead of receiving the test message that I submit via the application; I get a message stating, "Delivery to the following recipients failed." with my email address in it and the email to where the message should be sent.
At the end of the message it says "Mail Enabled Sub-domain check failed"
I've searched online for this message but get no hits so it may be a message that is generated only within our organization; or maybe no one has posted the problem before.
In either case, can anyone provide any insight as to what this message likely means? I receive no errors in the System or Application event logs on the server. Maybe there are some other areas I need to check to make certain the Web server is properly configured to function as an SMTP relay server? I am unfamiliar with configuring a Web Server in this manner.
I'm at a loss for clues at this point.
I am posting this answer as it pertained to our particular situation. I'm fairly certain that the message may be somewhat of a blanket error; and so there may be other scenario's for which the error could be generated.
As previously stated, the SMTP host address that our application is using is actually the host address of the Web Server on which the application is running. The Web Server is also configured as an SMTP relay server, meaning any mail requests sent via the application uses the local host to relay the message to the actual SMTP Exchange Server.
After hours of troubleshooting to find the cause of the error it was identified that the Server Name was not in the correct format to leverage the SMTP Relay system.
For example, the host name that was used was in the format:
machinenameCNameAlias.subdomain.domain.com
when it should have been
actualMachineName.subdomain.domain.com
In other words, the use of a CNAME alias was not valid when using an SMTP Relay Server. (At least in our configuration)
Once the CNAME alias was replaced with the actual name of the server, the error was resolved.
I am obviously not an expert in any respect with the particulars of Exchange or it's Configuration counter parts; but after searching online with the keywords, "CNames and SMTP Relay Servers"; I did find other potential references; maybe inferring that CNAME aliases are discouraged with similar configuration types.
If anyone else can affirm these observations, that would be great.
But as for the particular scenario for which the question was initially posted, this was the answer for us.

How to Detect Email Bounces with IIS 6 with C#

Just as the question says.
I am using IIS 6 to send emails out from my Windows Server with C#. I want to detect bounces with C# from the SMTP email server. Right now, all the bounces get sent to a Gmail account. I could just check and parse each email in that account, but I was wondering if there is any easier way like hooking up a windows service or something to the IIS 6 SMTP server.
Help?
Thanks!
I know little about the IIS6 SMTP server, but based on what I know about SMTP in general, I doubt you're going to have much luck. Your message to joe#foo.com gets forwarded from server to server until it ends up at the foo.com SMTP server, which then responds to the reply-to address that the "joe" mailbox doesn't exist. That server may have no direct contact with your SMTP server at all.
As a result, there's no opportunity for the IIS6 SMTP server to receive any information about the bounced message. I think your existing idea of polling the inbox for the reply-to address is probably going to be your best bet.

Sending Mail over proxy server

I am using a LAN network, which uses a proxy server. In C#, I am trying to develop an application through which I can send E-mails. But from my network, I can't send mail due to this proxy issue. From any other network, not dependent on proxy server, there is no problem to send mail.
I typed in command prompt, telnet smtp.gmail.com 25
and it displays it can't connect to 'smtp.gmail.com'
It sounds like your proxy is explicitly denying the gmail.com domain (if its a corporate network then many do). Can you reach gmail.com in your browser (if you can't this may put up a nasty looking alert from your systems guys).
There are a couple of ways round this:
Get smtp.gmail.com, or port 25 to smtp.gmail.com, unblocked on the proxy.
Get an smtp relay put in place instaed of using smtp from gmail. There's some info on this here.
Either way, time to go and be nice to your sys admins!

Mail from server going to junk folder

I am working on an ASP.NET website. I have a page where I'm sending mail. Here the user adds the recipient; the sender is his own id. When I run this application on my location machine the mail properly comes in my inbox but as I paste that page on the server and try mailing the mail comes in Junk folder.
Can somebody please help me out?
Check if your Sever IP is added in Relay list of SMTP server.
This doesn't sound like it has anything to do with code and more about setting your SMTP servers up properly in the realm of DNS and/or discussing it with your hosting provider. According to your post, your ability to send mail is not the issue - its more about how the receiving agent treats your email (tags it according to some rule, etc.). The only difference being "who" sends the email (your local machine, vs your server).
There are Postmaster resources - this one from everyone's favorite- AOL that you may find useful. You can also check with DNS blacklists if your server's IP is (unfortunately) listed.

Sending Email-SMTP Problem-C#.NET

I am struggling with this problem from yesterday.
What I have done so far?
I have used the code to send an email using local smtp server. Code is(C#.Net) Here.
I can telnet the localhost on port 25.
When I telnet: "220 DomainName Microsoft6 ESMTP Mail Service, Version 6.0.3790.3959 Ready at Date Time "
When I try to send the email, there are no errors in the code and code gets executed successfully without any error.
Errors:
When I check in the eventviewer, the error is : Message Delivery to Host 74.125.159.27 failed while delivering to the remote domain gmail.com for the following reason. The remote server did not respond to a connection attempt.
I know there is error in my SMTP Server Setup, I have not set it up properly. How do I Trouble shoot it.
I have downloaded a smtpdiag.exe from microsoft but, It doesn't do anything when clicking on .exe file loads up and disappears.
Resolutions Please?
Please help me how do I troubleshoot it. If you need more information please ask me, I will provide but try to help me
Thank you.
You are sending emails through IIS SMTP Server right?
And you are sending to your gmail address?
How OFTEN do you send them? Google as a kind of spam protection that fakes that the servers is not responding if an IP address tries to send too many emails at once.
There is a thread here at SO about it. But I can't seem to find it.

Categories

Resources