I have been messing with this website all day and I cannot get it to send an email from my contact.php page located here: http://cardiacnetwork.net/contact.php. However, when I upload the same files to another website through another hosting company, the e-mail sends just fine: http://lumaskinz.com/cardiac/contact.php. Both forms use the same code:
contact.php
[code]<?php session_start(); ?>
Cardiac Network
Stock Symbol CNWI.PK
Contact Us
| Cardiac Network Inc.
The most recognized name in documenting cardiac symptoms
We're waiting to hear from you.
<?php
$contact_form_fields = array(
array(‘name’ => ‘E-mail:’,
‘type’ => ‘email’,
‘require’ => 1),
array(‘name’ => ‘Subject:’,
‘type’ => ‘subject’,
‘require’ => 1),
array(‘name’ => ‘Message:’,
‘type’ => ‘textarea’,
‘require’ => 1));
$contact_form_graph = false;
$contact_form_xhtml = false;
$contact_form_email = "[email protected]";
$contact_form_encoding = “utf-8”;
$contact_form_default_subject = “Message from Contact Form”;
$contact_form_message_prefix = "Sent from contact form: ";
include_once “contact-form/contact-form.php”;
?>
Cardiac Network Inc.
Is a publicly trading company under the symbo
CNWI.PK
75180 Mediterranean,
Suite A-2 Palm Desert, CA 92211
tel: 760.565.7336
fax: 760.565.7339
email: [email protected]
[/code]
contact-form.php
[code]
<?php
$contact_form_msg_clear = 'Clear';
$contact_form_msg_submit = 'Submit';
$contact_form_msg_submit = $contact_form_graph ? '' : $contact_form_msg_submit;
$contact_form_msg_sent = 'Message sent';
$contact_form_msg_not_sent = 'Message not sent';
$contact_form_msg_invalid = 'Please, correct the fields marked with red';
?>
<?php
// ***** contact_form_mail *****
function contact_form_mail($to, $subject, $message, $headers = '', $charset = 'utf-8', $files = array())
{
if (!count($files))
{
$ext_headers = $headers;
$ext_headers .= "Content-Type: text/plain; charset=\"$charset\"\r\n";
$ext_message = $message;
}
else
{
$boundary = 'a6cd792e';
while (true)
{
if (strpos($subject, $boundary) !== false ||
strpos($message, $boundary) !== false) { $boundary .= dechex(rand(0, 15)) . dechex(rand(0, 15)); continue; }
foreach ($files as $fi_name => $fi_data)
if (strpos($fi_name, $boundary) !== false ||
strpos($fi_data, $boundary) !== false) { $boundary .= dechex(rand(0, 15)) . dechex(rand(0, 15)); continue; }
break;
}
$ext_headers = $headers;
$ext_headers .= "MIME-Version: 1.0\r\n";
$ext_headers .= "Content-Type: multipart/mixed; boundary=\"$boundary\"\r\n";
$ext_message = "This is a multi-part message in MIME format.";
$ext_message .= "\r\n--$boundary\r\n";
$ext_message .= "Content-Type: text/plain; charset=\"$charset\"\r\n\r\n";
$ext_message .= $message;
$ext_message .= "\r\n--$boundary\r\n";
foreach ($files as $i => $x)
{
$ext_message .= "Content-Type: {$x['type']}; name=\"{$x['name']}\"\r\n";
$ext_message .= "Content-Disposition: attachment\r\n";
$ext_message .= "Content-Transfer-Encoding: base64\r\n\r\n";
$ext_message .= chunk_split(base64_encode($x['data']));
$ext_message .= "\r\n--$boundary\r\n";
}
}
$error_reportings = error_reporting(E_ERROR | E_PARSE);
$res = mail($to, $subject, $ext_message, $ext_headers);
$error_reportings = error_reporting($error_reportings);
return $res;
}
// ***** contact_form_post *****
function contact_form_post($name)
{
global $contact_form_encoding;
if (isset($_POST[$name])) return htmlentities($_POST[$name], ENT_COMPAT, $contact_form_encoding);
if (isset($_GET [$name])) return htmlentities($_GET [$name], ENT_COMPAT, $contact_form_encoding);
return '';
}
// ***** Send Mail *****
if (count($_POST))
{
if (get_magic_quotes_gpc() && !function_exists('strip_slashes_deep'))
{
function strip_slashes_deep($value)
{
if (is_array($value)) return array_map('strip_slashes_deep', $value);
return stripslashes($value);
}
$_GET = strip_slashes_deep($_GET);
$_POST = strip_slashes_deep($_POST);
$_COOKIE = strip_slashes_deep($_COOKIE);
}
$patern_aux1 = "(\\w+(-\\w+)*)";
$patern_aux2 = "($patern_aux1\\.)*$patern_aux1@($patern_aux1\\.)+$patern_aux1";
$ename = '';
$email = '';
$esubj = $contact_form_default_subject;
$ehead = $contact_form_message_prefix;
$ebody = '';
$valid = true;
foreach ($contact_form_fields as $i => $x)
{
$_POST[$i] = isset($_POST[$i]) ? $_POST[$i] : '';
if ($x['type'] === 'upload')
{
if (isset($_POST["$i-clear"]) && $_POST["$i-clear"])
unset($_SESSION['contact-form-upload'][$i]);
if (isset($_FILES[$i]) &&
$_FILES[$i][ 'type'] &&
$_FILES[$i][ 'name'] &&
$_FILES[$i]['tmp_name'] &&
file_exists($_FILES[$i]['tmp_name']) &&
filesize($_FILES[$i]['tmp_name']) <= $x['maxsize'])
$_SESSION['contact-form-upload'][$i] =
array('type' => $_FILES[$i][ 'type'],
'name' => $_FILES[$i][ 'name'],
'data' => file_get_contents($_FILES[$i]['tmp_name']));
}
if ($x['type'] === 'checkbox' && trim($_POST[$i]) ||
$x['type'] === 'department' && trim($_POST[$i]) ||
$x['type'] === 'input' && trim($_POST[$i]) ||
$x['type'] === 'name' && trim($_POST[$i]) ||
$x['type'] === 'select' && trim($_POST[$i]) ||
$x['type'] === 'subject' && trim($_POST[$i]) ||
$x['type'] === 'textarea' && trim($_POST[$i]) ||
$x['type'] === 'email' && preg_match("/^$patern_aux2$/sDX", $_POST[$i]) ||
$x['type'] === 'turing' && isset($_SESSION['contact-form-number']) && $_POST[$i] === $_SESSION['contact-form-number'] ||
$x['type'] === 'upload' && isset($_SESSION['contact-form-upload'][$i]))
{
if ( $x['type'] === 'textarea')
$ebody .= "\r\n" . $_POST[$i] . "\r\n";
if ( $x['type'] !== 'textarea')
if (!$x['name'] && isset($x['prompt']))
$ehead .= $x['prompt'] . ' ' . $_POST[$i] . "\r\n";
else $ehead .= $x['name' ] . ' ' . $_POST[$i] . "\r\n";
}
elseif ($x['require'] || $_POST[$i] !== '')
{
$valid = false;
if (!$x['name'] && isset($x['prompt']))
$contact_form_fields[$i]['prompt'] = "
{$x['prompt']}";
else $contact_form_fields[$i]['name' ] = "
{$x['name' ]}";
}
switch ($x['type'])
{
case 'department': foreach ($x['items'] as $j => $y) if ($y === $_POST[$i]) $contact_form_email = $j; break;
case 'email': $email = $_POST[$i]; break;
case 'name': $ename = $_POST[$i]; break;
case 'subject': $esubj = $_POST[$i]; break;
}
}
if ($valid)
{
$mail_sent = contact_form_mail($contact_form_email, $esubj, $ehead . $ebody,
"From: $ename <$email>\r\n", $contact_form_encoding,
isset($_SESSION['contact-form-upload']) ? $_SESSION['contact-form-upload'] : array());
if ($mail_sent)
echo '
' . $contact_form_msg_sent . '
';
else echo '
' . $contact_form_msg_not_sent . '
';
if ($mail_sent) $_POST = array();
if ($mail_sent) $_SESSION = array();
}
else echo '
' . $contact_form_msg_invalid . '
';
}
$_SESSION['contact-form-number'] = str_pad(rand(0, 9999), 4, '0', STR_PAD_LEFT);
?>
<?php
$slash = $contact_form_xhtml ? ‘/’ : ‘’;
foreach ($contact_form_fields as $i => $x)
{
?>
<?=$x['name'];?> |
<?php
switch ($x['type'])
{
case 'name':
case 'email':
case 'input':
case 'subject':
?>
>
<?php
break;
case 'turing':
?>
>
>
>
<?=$x['prompt'];?>
<?php
break;
case 'upload':
?>
>
<?php
if (isset($_SESSION['contact-form-upload'][$i]))
{
?>
>
<?=$contact_form_msg_clear;?> <?=$_SESSION['contact-form-upload'][$i]['name'];?>
<?php
}
break;
case 'checkbox':
?>
<?=$slash;?>>
<?=$x['prompt'];?>
<?php
break;
case 'textarea':
?>
<?=contact_form_post($i);?>
<?php
break;
case 'select':
case 'department':
?>
<?=$x['default'];?>
<?php foreach ($x['items'] as $j => $y) { ?>><?=$y;?><?php } ?>
<?php
break;
}
?>
|
<?php
}
?>
|
> |
[/code]
The settings information for the server that it is not running on can be viewed at http://cardiacnetwork.net/php_info.php
Any help would be GREATLY appreciated.