-1

I am a nebie to php. I am using a pre build html template. Where I had to configure the form mentioned below. I have changed two values:

$emailAdmin = "myemailid@gmail.com",
$urlWebSite = "mydomain.co.cc"

but when I click on send email. It give an error message "Have been some problems sending the email."

<?php
// ------------------------------------------------ -----------------------------------
// CONFIGURATION PARAMETERS OF GENERAL
// ------------------------------------------------ -----------------------------------
$emailAdmin = "myemailid@gmail.com", // email admin where notices are sent
$urlWebSite = "mydomain.co.cc" // Website URL That Is added to the bottom of emails sent from contact form

$headers_mail = "From: Company Name <info@your_domain.com> \ nReply-to: info@your_domain.com";
define ("OGGETTO_MAIL", "Contact from the site.");

$str_contenuto_email = "
You are receiving this email Because someone used the card of contacts on your website.

Here the personal information we have That Contacted:

-------------------------------------------------- -----------
Name and Surname: {name}
E-mail: mail {}
IP Address: {ip}
-------------------------------------------------- -----------

This is the user's request:

-------------------------------------------------- -----------
Message: {body}
-------------------------------------------------- -----------

{url} ";
?>

I forgot to mention one more php file which I haven't configured it but its there by default in the include folder:

<?php
include_once("config.php");
//------------------------------------------------------------------------------------------------
// RECUPERO IL VALORE DI TUTTI I DATI INVIATI DALL'UTENTE
//------------------------------------------------------------------------------------------------
$str_ind_ip = $_SERVER['REMOTE_ADDR'];
foreach ($_POST as $key=>$value) {
    $$key = $value;
}
//------------------------------------------------------------------------------------------------
//  PROCEDURA DI INVIO MAIL
//-------------------------------------
$str_oggetto            = OGGETTO_MAIL;
$str_contenuto_email    = str_replace("{name}",$visitor,$str_contenuto_email);
$str_contenuto_email    = str_replace("{mail}",$visitormail,$str_contenuto_email);
$str_contenuto_email    = str_replace("{ip}", $str_ind_ip,$str_contenuto_email);
$str_contenuto_email    = str_replace("{corpo}",$notes,$str_contenuto_email);
$str_contenuto_email    = str_replace("{url}",$urlWebSite,$str_contenuto_email);
$headers                = $headers_mail;

if (!@mail($emailAdmin,$str_oggetto,$str_contenuto_email,$headers)) {
    echo "<div class=\"error\">Have been some problems sending the email.</div>";
} else {
    echo "<div class=\"success\">The email has been sent successfully.</div>";
}
Rahul dagli
  • 155
  • 1
  • 5
  • 14
  • 1
    *"Have been some problems sending the email"* is not a PHP error and its nowhere to be found in the code you've posted. This question isn't answerable in its current form but it's almost assuredly been asked before http://stackoverflow.com/questions/tagged/php+email – Mike B Feb 24 '12 at 14:44
  • where is your mail() Function? You define much, but i can't see where you send it - see http://php.net/manual/en/function.mail.php – Neysor Feb 24 '12 at 14:45
  • Well you are right its not php error but its displayed on my browser popup message. – Rahul dagli Feb 24 '12 at 14:46
  • Now there's a popup window? How much code have you left out? The form itself, the call to `mail()` or library-method, the error message, the popup response. Anything else? – Mike B Feb 24 '12 at 14:48
  • So many of these http://stackoverflow.com/questions/1552889/is-there-a-way-to-know-why-php-mail-function-returns-false-it-happens-sometime http://stackoverflow.com/questions/786221/mail-returns-false http://stackoverflow.com/questions/5496461/php-mail-function-returning-false-but-with-no-error http://stackoverflow.com/questions/7826821/sending-mail-with-php-not-working http://stackoverflow.com/questions/4495517/send-mail-using-php-failing http://stackoverflow.com/questions/2323463/how-can-i-catch-an-error-caused-by-mail – Mike B Feb 24 '12 at 14:56
  • Do I need to setup email account on my cpanel if I am using gmail account? – Rahul dagli Feb 24 '12 at 15:06
  • PLEASE Use the search box http://stackoverflow.com/questions/36079/php-mail-using-gmail – Mike B Feb 24 '12 at 15:08
  • let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/8183/discussion-between-rahul-dagli-and-mike-b) – Rahul dagli Feb 24 '12 at 15:10

1 Answers1

-1

You're missing the mail() php function

afrederick
  • 1,388
  • 1
  • 10
  • 24
  • 1
    His question was focused on the error message. This should be a comment asking for more code b/c it's clearly missing large chunks. – Mike B Feb 24 '12 at 14:45