0

To make a long story short ive spent the best of the past few days trying to find a bypass to a current issue I have with an Inhouse website. I need to create a submission form that will take user input and send it in an email (Or something that can notify people VIA email about a submission that gets stored) This is a IIS webpage that was setup many years ago mostly relying on static HTML pages and some CSS for basic layouts. Ive tried using things like a PHP submission form but I cant seem to get it to send the email out Ive also tried EmailJS but it is considered a security threat for the Organization I am working with.

Ive attached some code below but in reality I need more that just code as I dont know a way around it.

<?php
    if(isset($_POST['submit'])){
        $name=$_POST['name'];
        $email=$_POST['email'];
        $phone=$_POST['phone'];
        $msg=$_POST['msg'];

        $to=''; // Receiver Email ID, Replace with your email ID
        $subject='Form Submission';
        $message="Name :".$name."\n"."Phone :".$phone."\n"."Wrote the following :"."\n\n".$msg;
        $headers="From: ".$email;

        if(mail($to, $subject, $message, $headers)){
            echo "<h1>Sent Successfully! Thank you"." ".$name.", We will contact you shortly!</h1>";
        }
        else{
            echo "Something went wrong!";
        }
    }
?>

Above is just a basic PHP script that I was attempting to use to send the email but being as this is IIS It doesnt seem to work - I know there is a way around this but all the ways ive attempted havent seemed to work.

If anyone can give assistance on using a automatic email system for a user submission form from IIS it would be helpful.

  • The first place to start is whether the `if(mail(...))` is returning `true` or `false`. Also, do you have PHP error reporting turned on to show all warnings and errors? – Chris Haas Aug 30 '21 at 14:15
  • Does this answer your question? [PHP mail function doesn't complete sending of e-mail](https://stackoverflow.com/questions/24644436/php-mail-function-doesnt-complete-sending-of-e-mail) – CBroe Aug 30 '21 at 14:17
  • In case it returns true, the mentioned duplicate contains several different things to check. (And of course recommends avoiding `mail` altogether, in favor of a dedicated mailer library, as well.) – CBroe Aug 30 '21 at 14:18
  • The issue is I dont believe that IIS is considered a live host - which means this PHP script wont function if I understand correctly. So I need an alternate that works for IIS. – Michael Schwarz Aug 30 '21 at 14:23
  • 1
    I don't really know what you mean by "live host". Can you or anyone else get to this server? Is PHP installed? Are there any errors? Whether you do or don't receive an email is actually a totally different problem, too. So we need to figure out what is or isn't working. – Chris Haas Aug 30 '21 at 14:32
  • This is a server hosted through IIS that is only accessible via Intranet - which is what I meant by it isnt a live host as in a live website for anyone outside to connect to. the PHP script was just there as an example of what Ive tried it isnt what im asking as it doesnt seem to function under the IIS website we are running. – Michael Schwarz Aug 30 '21 at 14:52
  • Did you get any error messages when it didn't work on iis? – samwu Aug 31 '21 at 02:39
  • Im not sure how to get it to run on IIS which is why this thread was created in the first place... Thats why I asked for more information on using IIS to submit forms through email. – Michael Schwarz Sep 01 '21 at 13:24
  • It is difficult to reproduce your problem, I suggest you open a case via: https://support.microsoft.com. – samwu Sep 02 '21 at 08:47

0 Answers0