- Edited
Hello.
I used to make simple php mail form years ago and just got back into webdesign. I thought I would be able to figure this out but I´m clearly missing something. I did not write this code by the way.
I have this html form:
<div class="row">
<div class="col-md-6 control-group">
<div class="alt-placeholder">Name</div>
<input type="text" name="your-name" value="" size="40" placeholder="Name" data-validation-required-message="Please fill the required field." required>
<div class="help-block"></div>
</div>
<div class="col-md-6 control-group">
<div class="alt-placeholder">Email</div>
<input type="email" name="your-email" value="" size="40" placeholder="Email" data-validation-required-message="Please fill the required field." required>
<div class="help-block"></div>
</div>
<div class="col-md-12 control-group">
<div class="alt-placeholder">Message</div>
<textarea name="your-message" placeholder="Message" data-validation-required-message="Please fill the required field." required></textarea>
<div class="help-block"></div>
</div>
<div class="col-md-12 form-actions">
<input class="button" type="submit" value="Send">
</div>
</div>
</form>
And this php-file:
// Change this options:
$username = 'something@gmx.com';
$password = 'password';
$smtpHost = 'ssl://mail.gmx.com';
$smtpPort = '587';
$to = 'something@gmx.com';
$from = 'something@gmx.com';
$subject = 'Contact Form';
$successMessage = 'Message successfully sent!';
$replyTo = $_POST['your-email'];
$name = $_POST['your-name'];
$body = $_POST['your-message'];
$headers = array(
'From' => $name . " <" . $from . ">",
'Reply-To' => $name . " <" . $replyTo . ">",
'To' => $to,
'Subject' => $subject
);
$smtp = Mail::factory('smtp', array(
'host' => $smtpHost,
'port' => $smtpPort,
'auth' => true,
'username' => $username,
'password' => $password
));
$mail = $smtp->send($to, $headers, $body);
if (PEAR::isError($mail)) {
echo($mail->getMessage());
} else {
echo($successMessage);
}
?>
I downloaded the Pear Mail Package and uploaded it to the root folder.
I get error messages concerning the Pear-files and I have no clue.
Please. Hope someone can help :-)