Originally Said By: chiakioda428401
Problem 2
to send email from the php file, I need to set up smtp sereve, but I beleive the smtp server need authentication, but there is no option for that.
If I set as PEAR mail, I get error something like this,
"Parse error: syntax error, unexpected T_IF, expecting T_STRING in E:\xampp\htdocs\chabuta\webassist\security_assist\mail_php.php on line 88"
We are using justhost for hosting and I contacted them but they can't do tech support at all, the person I talked with didn't even know what smtp is.
I beleive problem 1 is independent problem, as it is the error before the email sending.
I am attaching forgotpassword.php and mail_php.php file and security assist setup window shots.
Thanks,
Hi, if it helps I had this issue yesterday using Windows 7 Pro & WAMP. I got round it by editing the php.ini file, look for section as below:
[mail function]
; For Win32 only.
; smtp
SMTP = ***.***.***.***
; smtp-port
smtp_port = 25
; For Win32 only.
; sendmail-from
sendmail_from = email@youraccount.co.uk
This is using an internal Exchange box on our LAN, not sure if it will work with Gmail, Yahoo etc due to authentication? Failing that can you upload to your hosting account to test? Save code below into php file in your site root or upload to hosting and just run browser, helped me identify if the issue was WA exte3nsions or my setup!
<?php
// Test PHP Email script by Nate Baldwin, www.mindpalette.com
unset($email);
unset($message);
$errors = "";
$formStatus = (isset($HTTP_POST_VARS['formStatus'])) ? $HTTP_POST_VARS['formStatus'] : "";
if ($formStatus == "submitted") {
$email = (isset($HTTP_POST_VARS['email'])) ? $HTTP_POST_VARS['email'] : "";
if ($email == "") $errors .= "Please enter your email address before submitting form.<br>\r\n";
$emailPattern = "^[A-Z0-9._-]+@[A-Z0-9._-]+\.[A-Z]{2,4}$";
if ($email != "" AND !eregi($emailPattern, $email))
$errors .= "The email address entered does not to be a valid address for testing.<br>\r\n";
if ($errors == "") {
$subject = "PHP Email Test";
$message = "If you receive this email, your server has successfully sent an email using PHP.\r\n";
@$mailStatus = mail($email, $subject, $message);
if (!$mailStatus) $errors .= "Server error - PHP has not been configured to send out emails yet, sorry.<br>\r\n";
}
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="content-type" content="text/html;charset=iso-8859-1">
<meta name="generator" content="Adobe GoLive">
<title>Test PHP Email Configuration</title>
<style type="text/css" media="screen"><!--
body, div, td, p { color: black; font-size: 13px; font-family: Verdana, Arial, Helvetica, sans-serif; background-color: #c8c8c8 }
a { color: #00417d; font-size: 13px; font-family: Verdana, Arial, Helvetica, sans-serif; text-decoration: none }
a:link { color: #00417d; font-size: 13px; font-family: Verdana, Arial, Helvetica, sans-serif; text-decoration: none }
a:visited { color: #00417d; font-size: 13px; font-family: Verdana, Arial, Helvetica, sans-serif; text-decoration: none }
a:hover { color: #0064ff; font-size: 13px; font-family: Verdana, Arial, Helvetica, sans-serif; text-decoration: underline }
.error { color: #c80019 }
.success { color: #00417d }
h1 { color: #00417d; font-size: 32px; font-family: "Times New Roman", Georgia, Times; font-weight: normal }
strong { font-size: 16px; font-weight: bold }
form { margin: 0; padding: 6px 0 }
--></style>
</head>
<body bgcolor="#ffffff">
<div align="center">
<h1>Test PHP Email</h1>
<p>To test your server's PHP email configuration, enter your valid<br>
email address below and hit the "test now" button.</p>
<hr width="75%">
<form id="FormName" action="#" method="post" name="FormName">
your email address: <input type="text" name="email" size="32"> <input type="hidden" name="formStatus" value="submitted"><input type="submit" name="submitButtonName" value="test now">
</form>
<?php
if ($formStatus == "submitted") {
if ($errors != "") {
print("
<hr width=\"75%\">
<span class=\"error\"><strong>ERROR:</strong><br>
$errors</span><br>
<br>
");
} else {
print("
<hr width=\"75%\">
<span class=\"success\"><strong>Success!</strong><br>
Email message has been sent.<br>
If you do not receive your email, try a different address.<br>
If still no luck, your server's outgoing email may not be working right.<br>
</span>
");
}
}
?><br>
<br>
<br>
<a href="http://www.mindpalette.com">www.mindpalette.com</a><br>
</div>
</body>
</html>