6 Replies - 1060 Views - Last Post: 14 June 2016 - 02:46 AM Rate Topic: -----

#1 icetana   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 7
  • Joined: 12-June 16

Need help with contact form

Posted 13 June 2016 - 03:35 AM

Hello everyone,

I have one 'small' problem for you but seems huge to me :)/>/> My onepage website is ready to be published, I have a modified template, and all is well but I can't get my contact form 'submit' button to work. In the documents that came with the template I have this '

Contact form
Template comes with ready to use:
Contact Form
Newsletter Form
All needed files are in /form directory.
Remember to includeon page.
To configure form just edit form/form.php and change e-mails to your
own :
That’s it!
Contact Form

$to = "[email protected]";
$from = "[email protected]";


Sounds so easy but...

So after clicking on 'submit' button the message should come to following email address '[email protected]' How do I make this happen? Please note my knowlege of PHP, CSS and html is veeeery limited. Here is the PHP form (hopefuly the correct one as I have few) I tried adding my email address here //set your email address
$mail->AddAddress($recipientEmail, $recipientName)
; but when I add character '@' the code seems to be wrong. Please help! Thanks in advance

<?php
/**
 * Setup mail server config
 */

//where we would like to send email
$recipientEmail = '[email protected]';
$recipientName = 'Recipient Name';

//Address which will be visible in "From" field
$fromEmail = '[email protected]';
$fromName = 'Site Admnistrator';

//Validation error messages
$requiredMessage = 'Field is required';
$invalidEmail = 'Invalid email';

/**
 * Advanced configuration - no need to modify
 */

require_once(dirname(__FILE__) . '/vendor/ctPHPMailer.php');
$mail = new ctPHPMailer();

//set your email address
$mail->AddAddress($recipientEmail, $recipientName);
$mail->SetFrom($fromEmail, $fromName);

$debug = false; //if problems occur, set to true to view debug messages

/**
 * For GMAIL configuration please use this values:
 *
 * $mail->Host = "smtp.gmail.com"; // SMTP server
 * $mail->Username = "[email protected]"; // SMTP account username
 * $mail->Password = "yourpassword"; // SMTP account password
 * $mail->Port = 465; // set the SMTP port for the GMAIL server
 * $mail->SMTPSecure = "ssl";
 *
 * More configuration options available here: https://code.google.com/a/apache-extras.org/p/phpmailer/wiki/ExamplesPage
 */

/**
 * SERVER CONFIG
 */

/**
 * Config for SMTP server - uncomment if you don't want to use PHP mail() function
 **/

/**
 * $mail->Host = "mail.example.com."; // sets the SMTP server
 * $mail->Username = "username"; // SMTP account username
 * $mail->Password = "password"; // SMTP account password
 * $mail->SMTPAuth = true; // enable SMTP authentication - true if username and password required
 * $mail->Port = 587; // set the SMTP port (usually 587, or 465 when SSL)
 * $mail->IsSMTP(); uncomment it to enable smtp
 * $mail->SMTPDebug = $debug ? 2 : 0; // debug messages - set debug to false on production!

This post has been edited by Dormilich: 13 June 2016 - 03:46 AM


Is This A Good Question/Topic? 0
  • +

Replies To: Need help with contact form

#2 Dormilich   User is offline

  • 痛覚残留
  • member icon

Reputation: 4278
  • View blog
  • Posts: 13,573
  • Joined: 08-June 10

Re: Need help with contact form

Posted 13 June 2016 - 03:44 AM

:code:
Was This Post Helpful? 0
  • +
  • -

#3 Dormilich   User is offline

  • 痛覚残留
  • member icon

Reputation: 4278
  • View blog
  • Posts: 13,573
  • Joined: 08-June 10

Re: Need help with contact form

Posted 13 June 2016 - 03:51 AM

Quote

but when I add character '@' the code seems to be wrong.

can you elaborate on that, because I don't see something odd.
Was This Post Helpful? 0
  • +
  • -

#4 icetana   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 7
  • Joined: 12-June 16

Re: Need help with contact form

Posted 13 June 2016 - 07:44 AM

View PostDormilich, on 13 June 2016 - 03:51 AM, said:

Quote

but when I add character '@' the code seems to be wrong.

can you elaborate on that, because I don't see something odd.


Hello and thank you for prompt reply. Well, there is nothing wrong with the code, what I need is that when someone comes to my site, fills up the contact form and clicks 'submit' button, the email arrives to my email address [email protected] Now, my question is- where in this code should I add [email protected]? I'm sure the answer is super simple, just not to me :( Sorry about the confusion..I have tried entering my email address here:

//set your email address
$mail->AddAddress($[email protected] $recipientName);
$mail->SetFrom($fromEmail, $fromName);

But that didn't work...

Thanks again
Was This Post Helpful? 0
  • +
  • -

#5 Dormilich   User is offline

  • 痛覚残留
  • member icon

Reputation: 4278
  • View blog
  • Posts: 13,573
  • Joined: 08-June 10

Re: Need help with contact form

Posted 13 June 2016 - 07:55 AM

View Posticetana, on 13 June 2016 - 04:44 PM, said:

Now, my question is- where in this code should I add [email protected]?

//set your email address
$mail->AddAddress([b]$[email protected][/b] $recipientName);

almost ...

//set your email address
$mail->addAddress('[email protected]');


see also https://github.com/PHPMailer/PHPMailer there is a full example.
Was This Post Helpful? 0
  • +
  • -

#6 icetana   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 7
  • Joined: 12-June 16

Re: Need help with contact form

Posted 14 June 2016 - 02:31 AM

I knew there was an easy solution :)/> Thank you!!!!!!!! btw My website is not online yet, code seems to be ok now, but when I test it in browser no email comes to my address after clicking 'submit'. Is that because website is not online? Or do I need to set some more parameters?

This post has been edited by Dormilich: 14 June 2016 - 02:43 AM

Was This Post Helpful? 0
  • +
  • -

#7 Dormilich   User is offline

  • 痛覚残留
  • member icon

Reputation: 4278
  • View blog
  • Posts: 13,573
  • Joined: 08-June 10

Re: Need help with contact form

Posted 14 June 2016 - 02:46 AM

you need to a webserver to run a PHP page. that may be an online server, but can be a local server as well. and if you're not connected to the internet emails obviously can't be delivered.

you should look into how PHPMailer handles errors, in case the problem is there (I could only help with SwiftMailer).
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1