piper338 Posted November 9, 2009 Report Posted November 9, 2009 Is there anyway to have the current Contact Form have a drop down and list all the staff members emails? Quote
Tom Posted November 9, 2009 Report Posted November 9, 2009 You would need to add your drop down to contact_form.tpl : <select name="recipient"> <option value="staffmember@website.com">Staff Member</option> <select> And in the php you would need to find the part where it mentions: Util::SendEmail(ADMIN_EMAIL, $subject, $message); and change to: Util::SendEmail($this->post->recipient, $subject, $message); where recipient is the name of your dropdown. I think 1 Quote
piper338 Posted November 9, 2009 Author Report Posted November 9, 2009 Guess what? It worked 8) thanks again Tom Chad C. Quote
TennShadow Posted January 24, 2010 Report Posted January 24, 2010 It appears the new contact_form.tpl doesn't have the below PHP code so I wasn't able to get this to work. Any ideas on how to make it work with the new form code? Util::SendEmail(ADMIN_EMAIL, $subject, $message); Quote
Tom Posted January 24, 2010 Report Posted January 24, 2010 You need to edit that part in the php, in core/modules/Contact/Contact.php Quote
TennShadow Posted January 25, 2010 Report Posted January 25, 2010 A big duh on my part. I was looking for the php code in conact_form.tpl. Got it working... Thanks! Quote
Thomas Posted May 2, 2010 Report Posted May 2, 2010 Ok Guys, I Used this on the Old version, Before the release of 2.0 i think, well anyways it was about 1 week after this post was made and I used this without any problems, Now ive updated the contact form with the new version, The CURRENT 2.1.934 version as its been updated, But, For some random reason, it dont work, And i submitted a test one about 5 hrs ago and got nothing back :/ Yes ive updated the .tpl's and also updated the Contact.php again but still, nothing! Ive checked all of the files related to the contact.php and contact_form.tpl but to be quite honest i cant see any problems relating to the non-sending mail Any Ideas? -Thomas. Quote
TennShadow Posted May 2, 2010 Report Posted May 2, 2010 Ok Guys, I Used this on the Old version, Before the release of 2.0 i think, well anyways it was about 1 week after this post was made and I used this without any problems, Now ive updated the contact form with the new version, The CURRENT 2.1.934 version as its been updated, But, For some random reason, it dont work, And i submitted a test one about 5 hrs ago and got nothing back :/ Yes ive updated the .tpl's and also updated the Contact.php again but still, nothing! Ive checked all of the files related to the contact.php and contact_form.tpl but to be quite honest i cant see any problems relating to the non-sending mail Any Ideas? -Thomas. The new contact form uses reCAPTCHA and the old one did not. While I'm not sure if that is your problem it is something to look at. What I had to do was use the new contact_form.tpl from the current version and then modify it to include this mod. It now works fine for me. Quote
Thomas Posted May 2, 2010 Report Posted May 2, 2010 Hmm, Ok Thanks, I think I'll Probably just go back to the normal contact.php and contact_form.tpl, see what happens with them, If it works i will see what to do from there. Thanks anyways -Thomas. Quote
Tomgis34 Posted April 9, 2011 Report Posted April 9, 2011 Hi, I have a problem with contact form. In fact, when I send a test mail via this form, it didn't receive/send. Code of Contact_form.tpl <h3>Contactez-nous</h3> <form method="post" action="<?php echo url('/contact'); ?>"> <table width='100%' border='0'> <tr> <td><strong>Nom:</strong></td> <td> <?php if(Auth::LoggedIn()) { echo Auth::$userinfo->firstname .' '.Auth::$userinfo->lastname; echo '<input type="hidden" name="name" value="'.Auth::$userinfo->firstname .' '.Auth::$userinfo->lastname.'" />'; } else { ?> <input type="text" name="name" value="" /> <?php } ?> </td> </tr> <tr> <td width="1%" nowrap><strong>Adresse e-mail:</strong></td> <td> <?php if(Auth::LoggedIn()) { echo Auth::$userinfo->email; echo '<input type="hidden" name="name" value="'.Auth::$userinfo->email.'" />'; } else { ?> <input type="text" name="email" value="" /> <?php } ?> </td> </tr> <tr> <td><strong>Destinataire: </strong></td> <td><select name="recipient"> <option value="info@worldskyairline.com">Le staff</option> <option value="executif@worldskyairline.com">La direction général</option> <option value="rh@worldskyairline.com">La direction des ressources humaines</option> <option value="thomas.nouyer@worldskyairline.com">La direction technique et des opérations</option> <select></td> </tr> <tr> <td><strong>Objet: </strong></td> <td><input type="text" name="subject" value="<?php echo $_POST['subject'];?>" /></td> </tr> <tr> <td><strong>Message:</strong></td> <td> <textarea name="message" cols='45' rows='5'><?php echo $_POST['message'];?></textarea> </td> </tr> <td> <input type="hidden" name="loggedin" value="<?php echo (Auth::LoggedIn())?'true':'false'?>" /> </td> <td> <input type="submit" name="submit" value='Send Message'> </td> </tr> </table> </form> Code of Contact.php : <?php /** * phpVMS - Virtual Airline Administration Software * Copyright (c) 2008 Nabeel Shahzad * For more information, visit www.phpvms.net * Forums: http://www.phpvms.net/forum * Documentation: http://www.phpvms.net/docs * * phpVMS is licenced under the following license: * Creative Commons Attribution Non-commercial Share Alike (by-nc-sa) * View license.txt in the root, or visit http://creativecommons.org/licenses/by-nc-sa/3.0/ * * @author Nabeel Shahzad * @copyright Copyright (c) 2008, Nabeel Shahzad * @link http://www.phpvms.net * @license http://creativecommons.org/licenses/by-nc-sa/3.0/ */ class Contact extends CodonModule { public function index() { if($this->post->submit) { $captcha = SessionManager::Get('captcha_sum'); if($this->post->loggedin == 'false') { # Make sure they entered an email address if(trim($this->post->name) == '' || trim($this->post->email) == '') { $this->set('message', 'You must enter a name and email!'); $this->render('core_error.tpl'); return; } } if($this->post->subject == '' || trim($this->post->message) == '') { $this->set('message', 'You must enter a subject and message!'); $this->render('core_error.tpl'); return; } $subject = 'New message from '.$this->post->name.' - "'.$this->post->subject.'"'; $message = DB::escape($this->post->message) . PHP_EOL . PHP_EOL; foreach($_POST as $field=>$value) { $message.="-$field = $value".PHP_EOL; } Util::SendEmail($this->post->recipient, $subject, $message); $this->render('contact_sent.tpl'); return; } # Just a simple addition $rand1 = rand(1, 10); $rand2 = rand(1, 10); $this->set('rand1', $rand1); $this->set('rand2', $rand2); $tot = $rand1 + $rand2; //echo "total: $tot <br />"; SessionManager::Set('captcha_sum', $tot); //echo 'output of $_SESSION: <br />'; //print_r($_SESSION); $this->render('contact_form.tpl'); } } Can you help me please ? Quote
Moderators mark1million Posted April 9, 2011 Moderators Report Posted April 9, 2011 That is not the default contact tpl, have a search here there is the code for what you want to achieve. Quote
Tom Posted April 9, 2011 Report Posted April 9, 2011 Looks like you're using a really old version of phpVMS/the template. I suggest updating. Quote
Tomgis34 Posted April 9, 2011 Report Posted April 9, 2011 Yes but with old or new version, we have same problem : Contact.php : <?php /** * phpVMS - Virtual Airline Administration Software * Copyright (c) 2008 Nabeel Shahzad * For more information, visit www.phpvms.net * Forums: http://www.phpvms.net/forum * Documentation: http://www.phpvms.net/docs * * phpVMS is licenced under the following license: * Creative Commons Attribution Non-commercial Share Alike (by-nc-sa) * View license.txt in the root, or visit http://creativecommons.org/licenses/by-nc-sa/3.0/ * * @author Nabeel Shahzad * @copyright Copyright (c) 2008, Nabeel Shahzad * @link http://www.phpvms.net * @license http://creativecommons.org/licenses/by-nc-sa/3.0/ */ class Contact extends CodonModule { public function index() { require_once CORE_LIB_PATH.'/recaptcha/recaptchalib.php'; if($this->post->submit) { if(Auth::LoggedIn() == false) { # Make sure they entered an email address if(trim($this->post->name) == '' || trim($this->post->email) == '') { $this->set('message', 'You must enter a name and email!'); $this->render('core_error.tpl'); return; } } $resp = recaptcha_check_answer (Config::Get('RECAPTCHA_PRIVATE_KEY'), $_SERVER["REMOTE_ADDR"], $_POST["recaptcha_challenge_field"], $_POST["recaptcha_response_field"]); // Check the captcha thingy if(!$resp->is_valid) { $this->set('captcha_error', $resp->error); $this->set('message', 'You failed the captcha test!'); $this->render('contact_form.tpl'); return; } if($this->post->subject == '' || trim($this->post->message) == '') { $this->set('message', 'You must enter a subject and message!'); $this->render('core_error.tpl'); return; } $subject = 'New message from '.$this->post->name.' - "'.$this->post->subject.'"'; $message = DB::escape($this->post->message) . PHP_EOL . PHP_EOL; unset($_POST['recaptcha_challenge_field']); unset($_POST['recaptcha_response_field']); foreach($_POST as $field=>$value) { $message.="-$field = $value".PHP_EOL; } $message = nl2br($message); $message = utf8_encode($message); Util::SendEmail($this->post->recipient, $subject, $message); $this->render('contact_sent.tpl'); return; } # Just a simple addition $rand1 = rand(1, 10); $rand2 = rand(1, 10); $this->set('rand1', $rand1); $this->set('rand2', $rand2); $tot = $rand1 + $rand2; //echo "total: $tot <br />"; SessionManager::Set('captcha_sum', $tot); //echo 'output of $_SESSION: <br />'; //print_r($_SESSION); $this->render('contact_form.tpl'); } } Contact_form.tpl : <center><h3>Formulaire de contact</h3></center> <form method="post" action="<?php echo url('/contact'); ?>"> <table width='100%' border='0'> <tr> <td><strong>Nom:</strong></td> <td> <?php if(Auth::LoggedIn()) { echo Auth::$userinfo->firstname .' '.Auth::$userinfo->lastname; echo '<input type="hidden" name="name" value="'.Auth::$userinfo->firstname .' '.Auth::$userinfo->lastname.'" />'; } else { ?> <input type="text" name="name" value="" /> <?php } ?> </td> </tr> <tr> <td width="1%" nowrap><strong>Adresse e-mail:</strong></td> <td> <?php if(Auth::LoggedIn()) { echo Auth::$userinfo->email; echo '<input type="hidden" name="name" value="'.Auth::$userinfo->email.'" />'; } else { ?> <input type="text" name="email" value="" /> <?php } ?> </td> </tr> <tr> <td><strong>Destinataire: </strong></td> <td><select name="recipient"> <option value="info@worldskyairline.com">Le staff</option> <option value="executif@worldskyairline.com">La direction général</option> <option value="rh@worldskyairline.com">La direction des ressources humaines</option> <option value="thomas.nouyer@worldskyairline.com">La direction technique et des opérations</option> <select></td> </tr> <tr> <td><strong>Objet: </strong></td> <td><input type="text" name="subject" value="<?php echo $_POST['subject'];?>" /></td> </tr> <tr> <td><strong>Message:</strong></td> <td> <textarea name="message" cols='45' rows='5'><?php echo $_POST['message'];?></textarea> </td> </tr> <tr> <td width="1%" nowrap><strong>Vérification</strong></td> <td> <?php echo recaptcha_get_html(Config::Get('RECAPTCHA_PUBLIC_KEY'), $captcha_error); ?> </td> </tr> <td> <input type="hidden" name="loggedin" value="<?php echo (Auth::LoggedIn())?'true':'false'?>" /> </td> <td> <input type="submit" name="submit" value='Envoyer'> </td> </tr> </table> </form> Thanks in advance Quote
Moderators mark1million Posted April 9, 2011 Moderators Report Posted April 9, 2011 This is what i use minus the addresses, contact_form.tpl <h3>Contact Us</h3> <form method="post" action="<?php echo url('/contact'); ?>"> <table width='100%' border='0'> <tr> <td><strong>Name:</strong></td> <td> <?php if(Auth::LoggedIn()) { echo Auth::$userinfo->firstname .' '.Auth::$userinfo->lastname; echo '<input type="hidden" name="name" value="'.Auth::$userinfo->firstname .' '.Auth::$userinfo->lastname.'" />'; } else { ?> <input type="text" name="name" value="" /> <?php } ?> </td> </tr> <tr> <td width="1%" nowrap><strong>E-Mail Address:</strong></td> <td> <?php if(Auth::LoggedIn()) { echo Auth::$userinfo->email; echo '<input type="hidden" name="name" value="'.Auth::$userinfo->email.'" />'; } else { ?> <input type="text" name="email" value="" /> <?php } ?> </td> </tr> <tr> <td><strong>Subject: </strong></td> <td><input type="text" name="subject" value="<?php echo $_POST['subject'];?>" /></td> <td></td> </tr> <td><strong>To whom:</strong></td> <td><select name="recipient"> <option value="emailaddresses_here" selected="selected">Name to Here</option> <option value="emailaddresses_here" selected="selected">Name to Here</option> <option value="emailaddresses_here" selected="selected">Name to Here</option> <option value="emailaddresses_here" selected="selected">Name to Here</option> </select> </td> <tr> <td><strong>Message:</strong></td> <td> <textarea name="message" cols='45' rows='5'><?php echo $_POST['message'];?></textarea> </td> </tr> <tr> <td width="1%" nowrap><strong>Captcha</strong></td> <td> <script type="text/javascript"> var RecaptchaOptions = { theme : 'white' }; </script> <?php echo recaptcha_get_html(Config::Get('RECAPTCHA_PUBLIC_KEY'), $captcha_error); ?> </td> </tr> <tr> <td> <input type="hidden" name="loggedin" value="<?php echo (Auth::LoggedIn())?'true':'false'?> Pilot ID = <?php echo Auth::PilotID(); ?>" /> </td> <td> <input type="hidden" name="ip" value="<?php echo $_SERVER['REMOTE_ADDR'] ?>"> <input type="submit" name="submit" value='Send Message'> </td> </tr> </table> </form></div> </div> </div> Contact.php <?php /** * phpVMS - Virtual Airline Administration Software * Copyright (c) 2008 Nabeel Shahzad * For more information, visit www.phpvms.net * Forums: http://www.phpvms.net/forum * Documentation: http://www.phpvms.net/docs * * phpVMS is licenced under the following license: * Creative Commons Attribution Non-commercial Share Alike (by-nc-sa) * View license.txt in the root, or visit http://creativecommons.org/licenses/by-nc-sa/3.0/ * * @author Nabeel Shahzad * @copyright Copyright (c) 2008, Nabeel Shahzad * @link http://www.phpvms.net * @license http://creativecommons.org/licenses/by-nc-sa/3.0/ */ class Contact extends CodonModule { public function index() { require_once CORE_LIB_PATH.'/recaptcha/recaptchalib.php'; if($this->post->submit) { if(Auth::LoggedIn() == false) { # Make sure they entered an email address if(trim($this->post->name) == '' || trim($this->post->email) == '') { $this->set('message', 'You must enter a name and email!'); $this->render('core_error.tpl'); return; } } $resp = recaptcha_check_answer (Config::Get('RECAPTCHA_PRIVATE_KEY'), $_SERVER["REMOTE_ADDR"], $_POST["recaptcha_challenge_field"], $_POST["recaptcha_response_field"]); // Check the captcha thingy if(!$resp->is_valid) { $this->set('captcha_error', $resp->error); $this->set('message', 'You failed the captcha test!'); $this->render('contact_form.tpl'); return; } if($this->post->subject == '' || trim($this->post->message) == '') { $this->set('message', 'You must enter a subject and message!'); $this->render('core_error.tpl'); return; } $subject = 'New message from '.$this->post->name.' - "'.$this->post->subject.'"'; $message = DB::escape($this->post->message) . PHP_EOL . PHP_EOL; unset($_POST['recaptcha_challenge_field']); unset($_POST['recaptcha_response_field']); foreach($_POST as $field=>$value) { $message.="-$field = $value".PHP_EOL; } $message = nl2br($message); $message = utf8_encode($message); Util::SendEmail($this->post->recipient, $subject, $message); $this->render('contact_sent.tpl'); return; } # Just a simple addition $rand1 = rand(1, 10); $rand2 = rand(1, 10); $this->set('rand1', $rand1); $this->set('rand2', $rand2); $tot = $rand1 + $rand2; //echo "total: $tot <br />"; SessionManager::Set('captcha_sum', $tot); //echo 'output of $_SESSION: <br />'; //print_r($_SESSION); $this->render('contact_form.tpl'); } } Quote
Strider Posted April 11, 2011 Report Posted April 11, 2011 I got it working perfectly in 2.1.934. Quote
Moderators mark1million Posted April 11, 2011 Moderators Report Posted April 11, 2011 No problem. Quote
Steve Bartlett Posted May 1, 2011 Report Posted May 1, 2011 How do I get this to show up on my website if it is included in the phpvms package that I downloaded and loaded onto my server? Quote
iva Posted July 8, 2012 Report Posted July 8, 2012 Hi guys ; I have a big prob with my contact form! I need to change the defult encoding to UTF-8 ... there is a line in Contact.php =[ $message = utf8_encode($message); ] ... but it's NOT working !? < for your info : I changed the coding for Coctact_form.tpl and Contact.php to UTF-8 ,But it does NOT work! > thanks guys for helping me... Quote
Strider Posted July 10, 2012 Report Posted July 10, 2012 One way is to go to your local.config file and go to line 97 where it says: Config::Set('PAGE_ENCODING', 'ISO-8859-1'); and change it to: Config::Set('PAGE_ENCODING', 'UTF-8'); Quote
iva Posted August 2, 2012 Report Posted August 2, 2012 Hi guys ; I have a big prob with my contact form! I need to change the defult encoding to UTF-8 ... there is a line in Contact.php =[ $message = utf8_encode($message); ] ... but it's NOT working !? < for your info : I changed the coding for Coctact_form.tpl and Contact.php to UTF-8 ,But it does NOT work! > thanks guys for helping me... One way is to go to your local.config file and go to line 97 where it says: Config::Set('PAGE_ENCODING', 'ISO-8859-1'); and change it to: Config::Set('PAGE_ENCODING', 'UTF-8'); [my problem SOLVED] thanks Mr.bean ; but i had a problem when i recieved an email from my Contact Form! In other words , i had problem when i tried to read mails in Yahoo or Gmail! I just remove this line $message = utf8_encode($message); from my CONTACT module and the problem SOLVED. I think the prob was that my CONTACT page was already UTF-8 and my CONTACT module was also encoding the DATA to UTF-8 , and we had 2 process for encoding! Quote
Kapitan Posted January 24, 2017 Report Posted January 24, 2017 On 09/04/2011 at 1:52 PM, Tomgis34 said: Hi, I have a problem with contact form. In fact, when I send a test mail via this form, it didn't receive/send. Code of Contact_form.tpl <h3>Contactez-nous</h3> <form method="post" action="<?php echo url('/contact'); ?>"> <table width='100%' border='0'> <tr> <td><strong>Nom:</strong></td> <td> <?php if(Auth::LoggedIn()) { echo Auth::$userinfo->firstname .' '.Auth::$userinfo->lastname; echo '<input type="hidden" name="name" value="'.Auth::$userinfo->firstname .' '.Auth::$userinfo->lastname.'" />'; } else { ?> <input type="text" name="name" value="" /> <?php } ?> </td> </tr> <tr> <td width="1%" nowrap><strong>Adresse e-mail:</strong></td> <td> <?php if(Auth::LoggedIn()) { echo Auth::$userinfo->email; echo '<input type="hidden" name="name" value="'.Auth::$userinfo->email.'" />'; } else { ?> <input type="text" name="email" value="" /> <?php } ?> </td> </tr> <tr> <td><strong>Destinataire: </strong></td> <td><select name="recipient"> <option value="info@worldskyairline.com">Le staff</option> <option value="executif@worldskyairline.com">La direction général</option> <option value="rh@worldskyairline.com">La direction des ressources humaines</option> <option value="thomas.nouyer@worldskyairline.com">La direction technique et des opérations</option> <select></td> </tr> <tr> <td><strong>Objet: </strong></td> <td><input type="text" name="subject" value="<?php echo $_POST['subject'];?>" /></td> </tr> <tr> <td><strong>Message:</strong></td> <td> <textarea name="message" cols='45' rows='5'><?php echo $_POST['message'];?></textarea> </td> </tr> <td> <input type="hidden" name="loggedin" value="<?php echo (Auth::LoggedIn())?'true':'false'?>" /> </td> <td> <input type="submit" name="submit" value='Send Message'> </td> </tr> </table> </form> Code of Contact.php : <?php /** * phpVMS - Virtual Airline Administration Software * Copyright (c) 2008 Nabeel Shahzad * For more information, visit www.phpvms.net * Forums: http://www.phpvms.net/forum * Documentation: http://www.phpvms.net/docs * * phpVMS is licenced under the following license: * Creative Commons Attribution Non-commercial Share Alike (by-nc-sa) * View license.txt in the root, or visit http://creativecommons.org/licenses/by-nc-sa/3.0/ * * @author Nabeel Shahzad * @copyright Copyright (c) 2008, Nabeel Shahzad * @link http://www.phpvms.net * @license http://creativecommons.org/licenses/by-nc-sa/3.0/ */ class Contact extends CodonModule { public function index() { if($this->post->submit) { $captcha = SessionManager::Get('captcha_sum'); if($this->post->loggedin == 'false') { # Make sure they entered an email address if(trim($this->post->name) == '' || trim($this->post->email) == '') { $this->set('message', 'You must enter a name and email!'); $this->render('core_error.tpl'); return; } } if($this->post->subject == '' || trim($this->post->message) == '') { $this->set('message', 'You must enter a subject and message!'); $this->render('core_error.tpl'); return; } $subject = 'New message from '.$this->post->name.' - "'.$this->post->subject.'"'; $message = DB::escape($this->post->message) . PHP_EOL . PHP_EOL; foreach($_POST as $field=>$value) { $message.="-$field = $value".PHP_EOL; } Util::SendEmail($this->post->recipient, $subject, $message); $this->render('contact_sent.tpl'); return; } # Just a simple addition $rand1 = rand(1, 10); $rand2 = rand(1, 10); $this->set('rand1', $rand1); $this->set('rand2', $rand2); $tot = $rand1 + $rand2; //echo "total: $tot <br />"; SessionManager::Set('captcha_sum', $tot); //echo 'output of $_SESSION: <br />'; //print_r($_SESSION); $this->render('contact_form.tpl'); } } Can you help me please ? On mine working only to email i added in admin panel , i add in form another two and dont send to them , Quote
SmarticleCo Posted March 9, 2020 Report Posted March 9, 2020 I cant seem to get this to work. Anyone able to help. It wont send the email. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.