Sending Email-SMTP Problem-C#.NET - c#

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.

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 know the different status of sended email in c#

I am Creating an application in c# . I have to know how can I know the status of the sended email.The status May be.
4. Track sent emails to determine if they were:
4.1 delivered
4.2 opened
4.3 recipient opt-out
4.4 bounced (with the reason for the bounce)
4.5 time/date sent
4.6 which links in the email were clicked (and time/date they were clicked)
4.7 IP address, if user clicked any links in the email
Should I use Any API or Dll or something else.Please help .Any Help will be Appreciated.
If you program your application to send mail through a hosted SMTP server like http://www.sendgrid.com or http://www.ultrasmtp.com, you can access the delivery status of messages that you've sent.
There is no easy way to do what you want. Actually this status can be tracked by your SMTP server itself and if you are using some third-party SMTP server like GMail or any corporate server, I 'm afraid they won't give you access to those information without using a authenticated client.
From your C# program, if the SmtpClient.Send() method returns true, you can assume the mail has been delivered to the SMTP server. If in case, the delivary fails, you should receive a mail to the outbound mail ID's inbox. If you want to make outbound mails appear in your outbox, you should configure IMAP/POP3 configurations accordingly.
There is no API or DLL available in exact form you want, as far as I know. You can try some other way like tracking a hash or embedded image in the mail-body from your server. But these are not reliable way as most mordern Messaging services have counter-measures for this.

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.

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.

Send mail from C# application not really working?

I have an email application where a user can fill out a form and the info get's mail to the form admin. I have the correct server and email credentials being set and i do not get any errors when the mail is sent. The To and From addresses are the same (admin#thedomain.com) It is like the mail is somewhere in limbo. I know the email account works, because I send mail to it from outlook. Any thoughts?
update:
Regarding code, I have created an abstraction to the System.Net.Mail.SmtpClient class. I can set another server and the code works. The server that does work is within my host’s network. The server that does not work is outside of the network. Strange thing is, like I said, I can setup the account in OutLook and I can send / receive mail fine. I’ll have to check with my vendor to see if the mail is indeed getting to their server.
My guess is permissions. Can your app send an email to your address?
I believe .net's system.web.mail sends email via relay. You need to check with your email admin to determine if your IP address is allowed on the server to relay mail.
It turned out to be a DNS issue with my hosting company. I could send mail via outlook becuase I was direclty connecting to the mail servers. The MX records were screwed up. Thanks to all who looked

Categories

Resources