When I submit my contact form on my server with Eukhost I get the following error;
Bad sequence of commands. The server response was: This mail server
requires authentication when attempting to send to a non-local e-mail
address. Please check your mail client settings or contact your
administrator to verify that the domain or address is defined for this
server.
This is the reply from my provider;
As per the error we suggest to you please update the SMTP
authentication on your mail script. Like email address and password
details.
After enabled the relay on your mail server you can able to sent mail
from above script. But as per security concern we not recommended to
enable replay on your server because it\'s change to start the
spamming on server.
Would anyone be able to take a look at my script and let me know how I can resolve this?
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Umbraco.Web.Mvc;
using site.Models;
using System.Net.Mail;
namespace site.Controllers
{
public class ContactSurfaceController : SurfaceController
{
public const string PARTIAL_VIEW_FOLDER = "~/Views/Partials/";
public ActionResult RenderForm()
{
return PartialView(PARTIAL_VIEW_FOLDER + "ContactForm.cshtml");
}
[HttpPost]
[ValidateAntiForgeryToken]
public ActionResult SubmitForm(ContactFormViewModel model)
{
if (ModelState.IsValid)
{
SendEmail(model);
TempData["ContactSuccess"] = true;
return RedirectToCurrentUmbracoPage();
}
return CurrentUmbracoPage();
}
private void SendEmail(ContactFormViewModel model)
{
MailMessage message = new MailMessage(model.EmailAddress, "[email protected]");
message.Subject = string.Format("Enquiry from {0} {1} - {2}", model.FirstName, model.LastName, model.Number);
message.Body = model.Message;
SmtpClient client = new SmtpClient("mail.sitedetails.org.uk", 25);
client.Send(message);
}
}
}
Error when submit contact form.
Hi,
When I submit my contact form on my server with Eukhost I get the following error;
This is the reply from my provider;
Would anyone be able to take a look at my script and let me know how I can resolve this?
Thanks in advance,
Matt
Try this:
is working on a reply...