I have installed PHPMailer on my website. But, I can\'t get it to work the way it should. When I send an email through the website, I get the following error:
I'd guess that the culprit is this:
$mail->FromName = trim_input($_POST['Name']);
What you're doing here is asking outlook to forge the from address by using arbitrary user input. This is generally a bad idea. The error message name suggests that this is where the problem is too: SendAsDeniedException, i.e. it doesn't like who you're sending as.
Try this instead:
$mail->From = trim_input("receivingEmailAdress@outlook.com");
$mail->FromName = trim_input($_POST['Name']);
$mail->AddAddress("receivingEmailAdress@outlook.com", "my name");
$mail->AddReplyTo(trim_input($_POST['Email']), trim_input($_POST['Name']));
This is: put your own address as the from address (so you're not forging anything), and use the submitter's address as a reply to, and also use their name alongside the from address.
This problem is covered in the PHPMailer troubleshooting guide.