scripts that can test if our server can send php mail
Moderator: General Moderators
scripts that can test if our server can send php mail
Hi
My 3 month issues is that so far I have not gotten any php mail forms to work on our server. We think we have tried everything, but we must be wrong. Are there any scripts around that I can run on the server that will just simply test if our mail works ? A script that doesn't need to be linked to external or local files ? If anyone knows of any, that would be GREAT!
I just can't figure out where the break is. When the form is filled in and completed, it never stops saying "waiting for http://www.mywebsite.com..." and I have never seen any error messages. Is that a clue? I am using $_POST and not $HTTP_POST_VARS, and we think we have set up the server SMPT settings correctly. The vars are coming from flash which has worked on other servers with the same php script!
I am totally confused, and frightened
If anyone knows about any scripts that can test if our server is configured correctly, please show some love this way.
Cheers,
Doug
My 3 month issues is that so far I have not gotten any php mail forms to work on our server. We think we have tried everything, but we must be wrong. Are there any scripts around that I can run on the server that will just simply test if our mail works ? A script that doesn't need to be linked to external or local files ? If anyone knows of any, that would be GREAT!
I just can't figure out where the break is. When the form is filled in and completed, it never stops saying "waiting for http://www.mywebsite.com..." and I have never seen any error messages. Is that a clue? I am using $_POST and not $HTTP_POST_VARS, and we think we have set up the server SMPT settings correctly. The vars are coming from flash which has worked on other servers with the same php script!
I am totally confused, and frightened
If anyone knows about any scripts that can test if our server is configured correctly, please show some love this way.
Cheers,
Doug
hmmmm..
Here is the code, I hope its helpful:
Cheers,
Doug
Code: Select all
<?php
$adminaddress = "someone@website.com.au";
$siteaddress ="www.website.com.au";
$sitename = "SiteName";
//Gets the date and time from your server
//$date = date("m/d/Y H:i:s");
// Gets the IP Address
if ($REMOTE_ADDR == "") $ip = "no ip";
else $ip = getHostByAddr($REMOTE_ADDR);
// Gets the POST Headers - the Flash variables
$action = $_POST['action'] ;
$firstname = $_POST['firstname'] ;
$lastname = $_POST['lastname'] ;
$email = $_POST['email'] ;
$phone = $_POST['phone'] ;
$time = $_POST['time'] ;
$how = $_POST['how'] ;
$promo = $_POST['promo'] ;
//Process the form data!
// and send the information collected in the Flash form to Your nominated email address
if ($action == "send") {
//
mail ("$adminaddress","Website Contact",
"A visitor at $sitename has left the following information\n
------------------------------
First Name: $firstname
Last Name: $lastname
Time: $time
Phone: $phone
Email: $email
Promo: $promo
How: $how
Logged Info :
------------------------------
Using: $HTTP_USER_AGENT
Hostname: $ip
IP address: $REMOTE_ADDR
Date/Time: $date","FROM:$adminaddress" ) ;
//This sends a confirmation to your visitor
mail ("$email","Thank You for visiting $sitename",
"Hi $firstname,
Thank you for your interest in $sitename!
We will get back to you as soon as possible.
Cheers,
$sitename
------------------------------
Phone: (02) 1234567899
$siteaddress","FROM:$adminaddress") ;
//Confirmation is sent back to the Flash form that the process is complete
$sendresult = "Thank you.";
$send_answer = "answer=";
$send_answer .= rawurlencode($sendresult);
echo $send_answer;
} //
?>
<?php
if (@mail($to, $subject, $message)) {
echo('<p>Mail sent successfully.</p>');
} else {
echo('<p>Mail could not be sent.</p>');
}
?>Cheers,
Doug
I thought that code would help...
You mean the bottom part of the code with the echo's to determine if the mail was sent?
I found that on another web site, and I thought it might help me determine if the mail is sending. Is this code helpful to me, if it isn't, ill just ditch it.
In regards to $action, here is the script in flash that sends the vars:
So I take it the flash variable arrive in the same order, and that $action must be the answer=confirm in php.
Is there anything else that looks sus?
Code: Select all
<?php
if (@mail($to, $subject, $message)) {
echo('<p>Mail sent successfully.</p>');
} else {
echo('<p>Mail could not be sent.</p>');
}
?>In regards to $action, here is the script in flash that sends the vars:
Code: Select all
loadVariablesNum(mailform, 0);
answer = confirm;
firstname = "";
lastname = "";
email = "";
phone = "";
time = "";
how = "";
promo = "";Is there anything else that looks sus?
found one more snippet
Found a bit more code:
Cheers,
Doug
Code: Select all
mailform = "http://www.mysite.com.au/mailform.php";
confirm = "Form Submitted.";
action = "send";Doug
Fixed it
Okay.. its a few months later
The issues is fixed. It was smtp issues - if anyone else is having issues with sending mail using php, investigate smtp clearance. I think a symptom of this was not receiving any error messages
Thanks for everyones help anyway, I appreciate it
Cheers,
Doug
The issues is fixed. It was smtp issues - if anyone else is having issues with sending mail using php, investigate smtp clearance. I think a symptom of this was not receiving any error messages
Thanks for everyones help anyway, I appreciate it
Cheers,
Doug