View Full Version : send email from contact page
tisoy
05-06-2006, 02:51 PM
I know this topic has been discussed before and I've read it a few days but I couldn't find it now. I spent almost half an hour but still no luck. :(
any help are much appreciated. thanks! :)
Simon Gooffin
05-08-2006, 09:48 AM
I think you are talking about sending email to administrator
*** open contacts.php ***
*** find the following code ***
if (!$error)
{
$gDirDb->addContact(addslashes($fullname), addslashes($email), addslashes($body));
$msg = " {$gDirLang['contact_added']}";
}
*** change it to the following ***
if (!$error)
{
mail($gDirConfig['site_email'], 'new contact', 'new contact on your site', "From: {$gDirConfig['site_email']}\r\n"."Reply-To: {$gDirConfig['site_email']}\r\n");
$gDirDb->addContact(addslashes($fullname), addslashes($email), addslashes($body));
$msg = " {$gDirLang['contact_added']}";
}
*** save changes ***
tisoy
05-08-2006, 11:38 AM
you got it right. thanks simon! :)
Simon Gooffin
05-08-2006, 12:14 PM
you are welcome
64North
08-10-2006, 11:47 AM
I realize this is an old thread, still, thanks for pointing out a solution Simon.
I am curious as to why the Contact Us messages are only accessible through the web in the first place? What was the rationale to store the contacts in the admin CP instead of sending them out as email to the admin?
Perhaps it would be possible to add an option that doesn't require code changes when someone would like to receive an email notification, or the actual Contact Us content in an email.
Don't get me wrong, the notification beats not having it, but I would prefer if the script would just send an email to the admin instead of storing the contact request in the admin cp.
jdiofu
08-12-2006, 04:58 PM
Yeah I think it's a great idea and save time when we reply to sender message's
Daniel Svanda
02-27-2007, 03:13 PM
Hello,
Do you can help how do same think in last version of your catalog system?
Best regards
Rodman
Dave Baker
02-27-2007, 07:09 PM
Hello Rodman,
Please try it:
***Open contact.php and find code***
if (!$error)
{
$_SESSION['pass'] = '';
loadClass("DirContact");
$Contact = &new Contact;
$Contact->connect();
$data = array(
"fullname"=> sql($fullname),
"email" => sql($email),
"reason" => sql($body),
"ip" => $_SERVER['REMOTE_ADDR']
);
$Contact->insert($data,array("date"=>"NOW()"));
$msg = $gDirLang['contact_added'];
}
***Replace with***
if (!$error)
{
$_SESSION['pass'] = '';
loadClass("DirContact");
$Contact = &new Contact;
$Contact->connect();
$data = array(
"fullname"=> sql($fullname),
"email" => sql($email),
"reason" => sql($body),
"ip" => $_SERVER['REMOTE_ADDR']
);
mail($config->get('site_email'), 'new contact', 'new contact on your site', "From: ".$config->get('site_email')."\r\n"."Reply-To: ".$config->get('site_email')."\r\n");
$Contact->insert($data,array("date"=>"NOW()"));
$msg = $gDirLang['contact_added'];
}
***Save changes***
Daniel Svanda
02-27-2007, 08:19 PM
Hello,
Is there some chance, how to send all message on the mail? This modification which you are write send me on my mail only notification about new message. Can you write me modification which send all message on my email?
Regards Rodman
Dave Baker
02-27-2007, 08:28 PM
Use this code:
if (!$error)
{
$_SESSION['pass'] = '';
loadClass("DirContact");
$Contact = &new Contact;
$Contact->connect();
$data = array(
"fullname"=> sql($fullname),
"email" => sql($email),
"reason" => sql($body),
"ip" => $_SERVER['REMOTE_ADDR']
);
mail($config->get('site_email'), 'new contact', $body, "From: ".$config->get('site_email')."\r\n"."Reply-To: ".$config->get('site_email')."\r\n");
$Contact->insert($data,array("date"=>"NOW()"));
$msg = $gDirLang['contact_added'];
}
Daniel Svanda
02-27-2007, 08:46 PM
OK, it looks much better, but in message in part "From:" is not mail of sender, but my mail... So, I can not reply on message and must login to administration, becouse if I want reply I need see email of submiter. If there some chance to corect this?
Regards Daniel
Dave Baker
02-27-2007, 11:28 PM
Daniel, please check this code:
if (!$error)
{
$_SESSION['pass'] = '';
loadClass("DirContact");
$Contact = &new Contact;
$Contact->connect();
$data = array(
"fullname"=> sql($fullname),
"email" => sql($email),
"reason" => sql($body),
"ip" => $_SERVER['REMOTE_ADDR']
);
mail($config->get('site_email'), 'new contact', $body, "From: ".$fullname." <".$email.">\r\n"."Reply-To: ".$config->get('site_email')."\r\n");
$Contact->insert($data,array("date"=>"NOW()"));
$msg = $gDirLang['contact_added'];
}
Daniel Svanda
02-28-2007, 05:04 PM
:good: It is exactly what I am want! :yahoo:
Dave Baker
03-01-2007, 05:55 PM
I'm glad :good:
vBulletin® v3.7.0, Copyright ©2000-2008, Jelsoft Enterprises Ltd.