October 3, 201114 yr Hi, I'm using jems contact form on a clients website,but have found out that the host has disabled the mail()function thingy (technical term) Apparently I can change something so it uses smtp of something.. As you can see, I don't do php or anything technical like that, so can someone point me in the right direction where I can find something where I basically copy and paste? Fanks!
October 3, 201114 yr Hi, I'm using jems contact form on a clients website,but have found out that the host has disabled the mail()function thingy (technical term) Apparently I can change something so it uses smtp of something.. As you can see, I don't do php or anything technical like that, so can someone point me in the right direction where I can find something where I basically copy and paste? Fanks! You will need to use the Mail::Factory method, which is pretty simple to use , u just need your smtp details, i looked up a resource for u that shows u how to use that method Heres the link
March 28, 201214 yr Hi I have stumbled across your forum post as I am desperately trying to work the exact same thing out for myself. After lots of reading I am starting to work out the direction I'm going but the problem I have is how to incorporate the SMTP bits into the current form I have. I looked at the code (as linked above) but in the contact form I have - using the unsecure option - I don't know what bits I should or can delete as there seems to be a lot about the validations of the form. I am very much a novice and so have used the Contact form with CAPTCHA - Contact form where you can view the files I think the one I need to change is the fgcontactform.php but the php code before the DOCTYPE on the contactform.php page asks for the email address (I'm hoping this copies properly!): <?PHP /* Contact Form from HTML Form Guide This program is free software published under the terms of the GNU Lesser General Public License. See this page for more info: http://www.html-form-guide.com/contact-form/creating-a-contact-form.html */ require_once("./_scripts/contactform/fgcontactform.php"); /*require_once("./_scripts/contactform/captcha-creator.php"); $formproc = new FGContactForm(); $captcha = new FGCaptchaCreator('scaptcha'); $formproc->EnableCaptcha($captcha); */ //1. Add your email address here. //You can add more than one receipients. $formproc->AddRecipient('info@website.co.uk'); //<<---Put your email address here //2. For better security. Get a random tring from this link: http://tinyurl.com/randstr // and put it here $formproc->SetFormRandomKey('CnRrspl1FyEylUj'); if(isset($_POST['submitted'])) { if($formproc->ProcessForm()) { $formproc->RedirectToURL("thank-you.php"); } } ?> <?php session_start(); if( isset($_POST['submit'])) { if( $_SESSION['security_code'] == $_POST['security_code'] && !empty($_SESSION['security_code'] ) ) { // Insert you code for processing the form here, e.g emailing the submission, entering it into a database. echo 'Thank you. Your message said "'.$_POST['message'].'"'; unset($_SESSION['security_code']); } else { // Insert your code for showing an error message here echo 'Sorry, you have provided an invalid security code'; } } else { ?> Thank you if anyone is able to help. Beth
March 28, 201214 yr There is also this version I have found, PHPMailer instead of PEAR - but I have the same issues - where to put it and what am I supposed to delete! require_once('../class.phpmailer.php');//include("class.smtp.php"); // optional, gets called from within class.phpmailer.php if not already loaded$mail = new PHPMailer(true); // the true param means it will throw exceptions on errors, which we need to catch$mail->IsSMTP(); // telling the class to use SMTP try { $mail->Host = "mail.yourdomain.com"; // SMTP server $mail->SMTPDebug = 2; // enables SMTP debug information (for testing) $mail->SMTPAuth = true; // enable SMTP authentication $mail->Host = "mail.yourdomain.com"; // sets the SMTP server $mail->Port = 26; // set the SMTP port for the GMAIL server $mail->Username = "yourname@yourdomain"; // SMTP account username $mail->Password = "yourpassword"; // SMTP account password $mail->AddReplyTo('name@yourdomain.com', 'First Last'); $mail->AddAddress('whoto@otherdomain.com', 'John Doe'); $mail->SetFrom('name@yourdomain.com', 'First Last'); $mail->AddReplyTo('name@yourdomain.com', 'First Last'); $mail->Subject = 'PHPMailer Test Subject via mail(), advanced'; $mail->AltBody = 'To view the message, please use an HTML compatible email viewer!'; // optional - MsgHTML will create an alternate automatically $mail->MsgHTML(file_get_contents('contents.html')); $mail->AddAttachment('images/phpmailer.gif'); // attachment $mail->AddAttachment('images/phpmailer_mini.gif'); // attachment $mail->Send(); echo "Message Sent OK<p></p>\n"; } catch (phpmailerException $e) { echo $e->errorMessage(); //Pretty error messages from PHPMailer } catch (Exception $e) { echo $e->getMessage(); //Boring error messages from anything else! } Edited March 28, 201214 yr by bethlou
Create an account or sign in to comment