Since Google Apps stopped being free of charge I needed an alternative service to hook a newly registered domain to in order to receive an authorization request when creating a new SSL certificate for the domain. Most CAs require an email address with the domain name to verify ownership. If you are just spinning up a domain without an email server this can cause issues. Zoho mail offers a free email service to suite this need, as long as you are only using it for one domain that is.
Creating a new account and setting up your domain with it is simple, Add a CNAME record to your domain with their information to verify ownership and you’re good to go!
I decided to write a simple subscription service to test out their email functionality. The only snag I ran into here was needing to enable incoming SMTP in the settings. The code required to write an email through the Zoho server is simple:
SmtpClient client = new SmtpClient { Host = "smtp.zoho.com", Port = 587, EnableSsl = true, DeliveryMethod = SmtpDeliveryMethod.Network, UseDefaultCredentials = false, Credentials = new NetworkCredential("from@address.com", "password") }; using (MailMessage notificationMessage = new MailMessage()) { notificationMessage.From = new MailAddress("from@address.com", "Display Name"); notificationMessage.To.Add("to@address.com"); notificationMessage.Subject = "You've been subscribed to cat facts!"; notificationMessage.Body = "Welcome to the club!"; client.Send(notificationMessage); }
Some limitations of Zoho are sending oh behalf of another email address. Unless the email you are sending is from an address of an account on Zoho the message will not send.
Getting below error when I am running your code
An unhandled exception of type ‘System.Net.Mail.SmtpException’ occurred in System.dll
Additional information: The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.5.1 Authentication Required.
Sounds like you could be using an incorrect password, or possibly have 2-factor authentication turned on? Also check out: https://forums.zoho.com/topic/reason%3A530-5-5-1-authentication-required-cant-send-email
Let me know what worked, I’ll update the post with your response.