Jump to content

this isn't working...


skubeedoo

Recommended Posts

I've got this email test script to test my server before installing a formmail script to make sure it's working. It isn't. My host is go daddy and they said the email should go through relay:hosting.secureserver.net  I don't know what to do. Where does the relay:hosting.secureserver.net go? Here's the test script:

 

<?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>\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>\n";
if ($errors == "") {
	$subject = "PHP Email Test";
	$message = "If you receive this email, your server has successfully sent an email using PHP.\n";
	@$mailStatus = mail($email, $subject, $message);
	if (!$mailStatus) $errors .= "Server error - PHP has not been configured to send out emails yet, sorry.<br>\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>

 

EDITED BY akitchin: added code tags - please use code tags in any future posts on these forums.

Link to comment
https://forums.phpfreaks.com/topic/162672-this-isnt-working/
Share on other sites

do daddy they do hosting? i thought they only gave .com domain names you sure go daddy is hosting your script? nothing you should worry about the php.ini go daddy is hosting your files should be already pre-configured to support mail() function perfectly. If not then google "godaddy mail function php"

 

i did the google search for you and found this

 

Sending Email using PHP from Godaddy host
Godaddy has the php.ini file configured with all the information.
This is the code to send a email using php is:
PHP Code:
<?php
include_once("Mail.php"); 
... 

$to = "[email protected]";  
$subject = "Email from php"; 
$body = "Hi \n this is a test"; 

mail($to, $subject, $body); 

...


this just works in the godaddy host, no for test locally.
it works for me.
just try it.

Link to comment
https://forums.phpfreaks.com/topic/162672-this-isnt-working/#findComment-858507
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.