mail problem - deadline!!!!!
| From: | Luc | Date: | Mon, 06 Aug 2007 22:59:36 +0000 |
| Subject: | mail problem - deadline!!!!! | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-260256@lists.php.net to get a copy of this message | ||
Good evening list,
i'm having a strange mail problem:
i have 2 contact-forms on a site, where 1 get's send to the e-mail
account and the other doesn't. I've tested them both on my remote
server and they work, but when i upload them to the clients' server,
1 doesn't arrive in the mailbox and the other one does.
Code for the troublesome form:
<?
// set your own preferences here
#############################################################
// Your email address
$youremail = 'xxxx@xxxxxxx.com.br';
// Your web site title (John Doe's Site)
$websitetitle = 'xxxxx xxxxx xxxxxx';
// Path to "thanks for the message" page
$thankyoupage = 'http://www.XXXXXXXXXXX.com.br/Pages/Contact_success1.php';
// Send notification to sender (use false if not required)
$sendnotification = true;
// Continue with your error checking, output of form, et cetera.
$contact_form_action = $_SERVER['PHP_SELF'];
if ((isset($_POST["sendcontact"])) && ($_POST["sendcontact"] ==
"contactsent")) {
$contacter_form_error = array();
if (empty($_POST['empresa_name'])){
$contacter_form_error[] = 'favor preencher nome da empresa';
}
if (empty($_POST['contato_name'])){
$contacter_form_error[] = 'favor preencher nome do contato';
}
if (empty($_POST['fone'])){
$contacter_form_error[] = 'favor preencher número do telefone';
}
if (empty($_POST['contato_email'])){
$contacter_form_error[] = 'favor preencher seu e-mail';
}
if (empty($_POST['produto'])){
$contacter_form_error[] = 'favor preencher o produto';
}
if (empty($_POST['origem'])){
$contacter_form_error[] = 'favor preencher origem';
}
if (empty($_POST['destino'])){
$contacter_form_error[] = 'favor preencher destino';
}
if (empty($_POST['quantidade'])){
$contacter_form_error[] = 'favor preencher quantidade';
}
if (empty($_POST['peso'])){
$contacter_form_error[] = 'favor preencher peso';
}
if (empty($_POST['comprimento'])){
$contacter_form_error[] = 'favor preencher comprimento';
}
if (empty($_POST['altura'])){
$contacter_form_error[] = 'favor preencher altura';
}
if (empty($_POST['largura'])){
$contacter_form_error[] = 'favor preencher largura';
}
else {
$empresa_name = stripslashes($_POST['empresa_name']);
$contato_email = stripslashes($_POST['contato_email']);
$body =<<<EOB
Prezado,
Favor cotar, conforme os seguintes dados:
Empresa: $_POST[empresa_name]
Contato: $_POST[contato_name]
Fone: $_POST[fone]
Fax: $_POST[fax]
Email: $_POST[contato_email]
Produto: $_POST[produto]
Origem: $_POST[origem]
Destino: $_POST[destino]
Quantidade: $_POST[quantidade]
Peso: $_POST[peso]
Comprimento: $_POST[comprimento]
Altura: $_POST[altura]
Largura: $_POST[largura]
Grato.
Atenciosamente,
$_POST[contato_name]
EOB;
$contato_name = $_POST['contato_name'];
$subjectline = "$websitetitle | Orçamento de empresa";
$notification_message = "Obrigado por nos contatar, $contato_name. Recebemos sua mensagem e
entraremos em contato em breve.";
$notification_subject = "Obrigado por sua mensagem para $websitetitle.";
@mail($contato_email,$subjectline,$body, "From: $contato_email");
@mail($contato_email,$notification_subject,$notification_message, "From: $youremail");
header("Location:$thankyoupage");
}
}
some html tags
error checking:
// Print form field errors if present
if (count($contacter_form_error)>0){
print '<p id="bottom"><strong>Algo está
errado:</strong></p>'."\n";
print '<ul>'."\n";
foreach($contacter_form_error as $form_err) {
print "<li class=\"error\">$form_err</li>\n";
}
print '</ul>'."\n";
}
?>
form:
<form method="post" id="contactform" action="<? print
$contact_form_action; ?>">
<p>Todos os campos obrigatórios são marcados com asteriscos (<span
class="required">*</span>).</p>
<fieldset>
<legend>Seus Dados</legend>
<label for="empresa_name">Empresa <span
class="required">*</span></label>
<br />
<input type="text" id="empresa_name" name="empresa_name"
size="30" value="<? print $empresa_name; ?>" />
<br />
<label for="contato_name">Contato <span
class="required">*</span></label>
<br />
<input type="text" id="contato_name" name="contato_name"
size="30" value="<? print $contato_name; ?>" />
<br />
<label for="fone">Número do telefone <span
class="required">*</span></label>
<br />
<input type="text" id="fone" name="fone" size="30"
value="<? print $fone; ?>" />
<br />
<label for="fax">Fax</label>
<br />
<input type="text" id="fax" name="fax" size="30"
value="<? print $fax; ?>" />
<br />
<label for="contato_email">E-mail <span
class="required">*</span></label>
<br />
<input type="text" id="contato_email" name="contato_email"
size="30" value="<? print $contato_email; ?>" />
<br />
<label for="produto">Produto <span
class="required">*</span></label>
<br />
<input type="text" id="produto" name="produto" size="30"
value="<? print $produto; ?>" />
<br />
<label for="origem">Origem <span
class="required">*</span></label>
<br />
<input type="text" id="origem" name="origem" size="30"
value="<? print $origem ?>" />
<br />
<label for="destino">Destino <span
class="required">*</span></label>
<br />
<input type="text" id="destino" name="destino" size="30"
value="<? print $destino; ?>" />
<br />
<label for="quantidade">Quantidade <span
class="required">*</span></label>
<br />
<input type="text" id="quantidade" name="quantidade"
size="30" value="<? print $quantidade; ?>" />
<br />
<label for="peso">Peso <span
class="required">*</span></label>
<br />
<input type="text" id="peso" name="peso" size="30"
value="<? print $peso; ?>" />
<br />
<label for="comprimento">Comprimento <span
class="required">*</span></label>
<br />
<input type="text" id="comprimento" name="comprimento"
size="30" value="<? print $comprimento; ?>" />
<br />
<label for="altura">Altura <span
class="required">*</span></label>
<br />
<input type="text" id="altura" name="altura" size="30"
value="<? print $altura; ?>" />
<br />
<label for="largura">Largura <span
class="required">*</span></label>
<br />
<input type="text" id="largura" name="largura" size="30"
value="<? print $largura; ?>" />
<br />
</fieldset>
<input type="hidden" name="sendcontact" value="contactsent" />
<input type="submit" value="Enviar" />
</form>
Code for the working form:
<?
// set your own preferences here
#############################################################
// Your email address
$youremail = 'xxxx@xxxxxx.com.br';
// Your web site title (John Doe's Site)
$websitetitle = 'xxxx xxxx xxx';
// Path to "thanks for the message" page
$thankyoupage = 'http://www.xxxxxx.com.br/Pages/Contact_success.php';
// Send notification to sender (use false if not required)
$sendnotification = true;
#############################################################
// Do not edit below this
#############################################################
$contact_form_action = $_SERVER['PHP_SELF'];
if ((isset($_POST["sendcontact"])) && ($_POST["sendcontact"] ==
"contactsent")) {
$contacter_form_error = array();
if (empty($_POST['contact_name'])){
$contacter_form_error[] = 'favor preencher seu nome';
}
if (empty($_POST['contact_email'])){
$contacter_form_error[] = 'favor preencher seu e-mail';
}
if (empty($_POST['contact_comment'])){
$contacter_form_error[] = 'favor preencher seu comentário';
}
else {
$contact_name = stripslashes($_POST['contact_name']);
$contact_email = stripslashes($_POST['contact_email']);
$contact_comment = $contact_name." enviou:\n
\"".stripslashes($_POST['contact_comment'])."\"\n";
$subjectline = "$websitetitle | Mensagem de $contact_name";
if(!empty($_POST['contact_phone'])) {
$contact_comment .= '(Numero de telephone:
'.stripslashes($_POST['contact_phone']).')';
}
mail($youremail, $subjectline, $contact_comment, "From: $contact_email");
if($sendnotification == true) {
$notification_message = "Obrigado por nos contatar, $contact_name.
Recebemos sua mensagem e entraremos em contato em breve.";
$notification_subject = "Obrigado por sua mensagem para
$websitetitle.";
mail($contact_email, $notification_subject, $notification_message,
"From: $youremail");
}
header("Location:$thankyoupage");
}
}
?>
some html tags
error checking:
// Print form field errors if present
if (count($contacter_form_error)>0){
print '<p id="bottom"><strong>Algo está
errado:</strong></p>'."\n";
print '<ul>'."\n";
foreach($contacter_form_error as $form_err) {
print "<li class=\"error\">$form_err</li>\n";
}
print '</ul>'."\n";
}
?>
Form tags.....
--
Best regards,
Luc
________________________
Powered by The Bat! version 3.99.3 with Windows XP (build 2600),
version 5.1 Service Pack 2 and using the best browser: Opera.
Pussy Galore: "My name is Pussy Galore." - James Bond: "I must be
dreaming." - Bond meets Pussy Galore - Goldfinger (film 1964)