• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 638
  • Last Modified:

Cannot send e-mail internal domain webserver

I just finished to setup a new windows based webserver.
Installation: Windows 2008 X64, IIS7, MailEnable Pro 5.06, Plesk Control Panel 10.2, MSSQL 2008, MySQL 5.xx, PHP 5.2x.

The problem: The contact forms of other PHP based forms are not sending the email.
The email works normaly and I can send and receive e-mail on three diferent domains I am allready hosting. The PHP forms are working just fine on a different server so that is nothing wrong with them.
I don't know if PHP is the problem of just the mailserver setup. I am new with mailenable but i can't see what can be wrong in there because normal SMTP traffic works just fine.
0
cemag
Asked:
cemag
  • 7
  • 6
1 Solution
 
Dave BaldwinFixer of ProblemsCommented:
0
 
cemagAuthor Commented:
Allready checked that. 127.0.0.1 is allready set als "Privileged Ip Address" for Relay.
This it is not the problem...
0
 
Dave BaldwinFixer of ProblemsCommented:
PHP on Windows knows how to connect to the IIS SMTP server, it's setup to do so by default.  And the IIS SMTP server is setup to accept that email by default.  Other than that, every mail server I've become aware of needs to be set up to accept and deny requests from different places or IP addresses.

Are you getting an error message?  Also, the PHP mail() function won't do authorizations.  You would have to add a different mailer function/class and change some code to do that.
0
What Security Threats Are We Predicting for 2018?

Cryptocurrency, IoT botnets, MFA, and more! Hackers are already planning their next big attacks for 2018. Learn what you might face, and how to defend against it with our 2018 security predictions.

 
cemagAuthor Commented:
Hello Dave!

This are sites that I have migrated from another windows hosting server with almost similar configuration. Al the same behalve the mailserver. I use Smartermail on the other one.
One think i think  is sure: it is all about PHP. this is the only think which  does not work. The problem relate only to forms on websites. Even Plesk is sending rapport files without problems.
Quiet fustrating...
0
 
Dave BaldwinFixer of ProblemsCommented:
Are you getting an error message?
0
 
cemagAuthor Commented:
sorry, no. nothing
0
 
Dave BaldwinFixer of ProblemsCommented:
Here is my self-contained PHP Email demo.  It is set to report all errors.  I know you have your own forms but this is very simple and may tell us something.  Put in your own email address in '$toText' and try it.
<?php
error_reporting(E_ALL);
ini_set('display_errors','On');

# some settings of POST vars
if (!isset($_POST['send']))  $send = ''; else $send = $_POST['send'];
if (!isset($_POST['toText'])) $toText = ''; else $toText = $_POST['toText'];
if (!isset($_POST['ccText'])) $ccText = ''; else $ccText = $_POST['ccText'];
if (!isset($_POST['subjectText'])) $subjectText = ''; else $subjectText = $_POST['subjectText'];
if (!isset($_POST['msgText'])) $msgText = ''; else $msgText = $_POST['msgText'];
if (!isset($_POST['ccText'])) $ccTexth = ''; else $ccText = $_POST['ccText'];
if (!isset($_POST['bccText'])) $bccText = ''; else $bccText = $_POST['bccText'];
if (!isset($_POST['nameText'])) $nameText = ''; else $nameText = $_POST['nameText'];
if (!isset($_POST['fromText'])) $fromText = ''; else $fromText = $_POST['fromText'];

if ($send == "") {
    $title="Test Email Page";
    $announce="---";
}
else {
	if($fromText === "") die("No name!");
  $toText="youremail@yourdomain.com";
	$title="Test Email Page";
  $announce="Your Message has been Sent!";
	$header = "From: ".$fromText."\r\n";
//	$header .= "Cc: ".$ccText."\n";
	$header .= "Reply-To : ".$fromText."\r\n";
	$header .= "Return-Path : ".$fromText."\r\n";
	$header .= "X-Mailer: PHP\r\n";
	$header .= "MIME-Version: 1.0\r\n";
	$header .= "Content-Type: text/plain; charset=iso-8859-1\r\n";
//	ini_set(sendmail_from,$fromText);  
	mail($toText, $subjectText, $msgText, $header, '-f'.$fromText);
//	ini_restore(sendmail_from);
}
?>

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title><?php echo($title)?></title>
<style type="text/css">
<!-- 
A:link { color: #999999; }
A:visited { color: #999999; }
A:hover {color: #0099ff;}
-->
</style>
<script type="text/javascript">
<!--
function check()
{
var at=document.getElementById("fromText").value.indexOf("@");
var eml=document.getElementById("fromText").value;
var nam=document.getElementById("nameText").value;
var alerttxt="";
var submitOK="true";

if (eml.length < 5 || at == -1)
    {
    alerttxt=alerttxt+"Please enter a valid e-mail address!\r\n";
    submitOK="false"
    //return false;
    }
if (nam.length < 3)
    {
    alerttxt=alerttxt+"Please enter your name.\r\n";
    submitOK="false"
    //return false;
    }
if (submitOK=="false")
    {
    alert(alerttxt);
    return false;
    }

}

// -->
</script>
</head>

<body bgcolor="#ddeedd">
<div align="center">
<table border="0" cellpadding="0" cellspacing="0" summary="" width="580">
<tr><td align="center">

<?php
if ($send != "") {
   	echo ("To: ".$toText."<br>\r\nSubject: ".$subjectText."<br>\r\n".$msgText."<br>\r\n".$header);
		}
?>

<p><b><font color="#000000" size="5">Test Email</font></b></p>
<font size="4" color="#000000">

<!--   <form method="POST" action="<?php echo($PHP_SELF)?>"> -->
  <form method="POST" action="Email.php" onsubmit="return check();">
    <p><font size="3"><b>Name: <input type="text" name="nameText" id="nameText" size="46"></b></font></p>
    <p><font size="3"><b>Email: <input type="text" name="fromText" id="fromText" size="46"></b></font></p>
    <input type="hidden" name="subjectText" value="Web Mail">
    <p><font face="Arial" size="3"><b>Message Text:</b></font></p>
    <p><font face="Arial" size="3"><b><textarea rows="6" name="msgText" cols="60"></textarea></b></font></p>
    <p><font size="3"><b><input type="submit" value="Send" name="send" style="font-family: Arial; font-size: 12pt; font-weight: bold"></b></font></p>
    <input type="hidden" name="state" value="1">
  </form>
  <b><font face="Arial" size="4" color="#e00000"><?php echo($announce)?></font></b><br><br>

</font>
</td></tr>
</table> 
</div>


</body>
</html>

Open in new window

0
 
cemagAuthor Commented:
i have to do thst after easter on monday... thanks
0
 
Dave BaldwinFixer of ProblemsCommented:
Cool, let me know what happens.  Have a good weekend.
0
 
cemagAuthor Commented:
Hello Dave!

I just got back from a "long" wekend and tried your mailform. It works fine but I don't get any error. MailForm Output
It seems that thet e-mail has been send but it gets "lost" some how.
0
 
Dave BaldwinFixer of ProblemsCommented:
What do you have in 'php.ini' for you SMTP server?  This is what I have.
[mail function]
; For Win32 only.
SMTP = localhost
smtp_port = 25

; For Win32 only.
sendmail_from = xxx@xxxxxx.com

Open in new window

0
 
cemagAuthor Commented:
Thank's Dave! Your tips help me find the problem.
Until next time...
Best regards,
Gabriel Thijssen
0
 
Dave BaldwinFixer of ProblemsCommented:
You're welcome, glad you got it fixed.
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 7
  • 6
Tackle projects and never again get stuck behind a technical roadblock.
Join Now