Hi,
I've today moved to Zoho on recommendation, but I'm having issues with a .net contact form on my website.
My previous code would look like the following, and the email received would have the senders emails address, making it easy to reply.
This setup fails with Zoho due to the dreaded Relaying disallowed error, because of the 'from' address.
- var body = "<p>Email From: {0} ({1})</p><p>Phone: {2}</p><p>Message:</p><p>{3}</p>";
- var message = new MailMessage();
- message.To.Add(new MailAddress(my email address)); // replace with valid value
- message.From = new MailAddress(form.Email); // replace with valid value
- message.Subject = "Email from the Website";
- message.Body = string.Format(body, form.Name, form.Email, form.Telephone, form.Message);
- message.IsBodyHtml = true;
- using (var smtp = new SmtpClient())
- {
- var credential = new NetworkCredential
- {
- UserName = "my email address",
- Password = "my password"
- };
- smtp.UseDefaultCredentials = false;
- smtp.Credentials = credential;
- smtp.Host = "smtp.zoho.eu";
- smtp.Port = 587;
- smtp.EnableSsl = false;
- smtp.Send(message);
- }
I've had to replace the above with the following, but the from address I receive is, of course, my own! How can I have a contact form, which when received at my end, has the correct from address?
- SmtpClient smtp = new SmtpClient("smtp.zoho.eu", 587); //465 - SSL | 587 - TLS
- smtp.EnableSsl = true;
- smtp.UseDefaultCredentials = false;
- smtp.Credentials = new NetworkCredential("my email address, "my password");
- MailMessage msg = new MailMessage("my email address", "my email address");
- //msg.From = new MailAddress(form.Email);
- msg.Subject = message.Subject;
- msg.Body = message.Body;
- msg.IsBodyHtml = true;
This seems to be such a simple thing, and I've never encountered it previously - i've had my email address since 1999!! If this can't be resolved, can my account be closed and refunded?
Regards,
Craig Richards