StartBootstrap / startbootstrap-modern-business

A multipurpose Bootstrap full website template created by Start Bootstrap
https://startbootstrap.com/template/modern-business/
MIT License
1.02k stars 1.18k forks source link

Update contact.html #33

Closed andrea-ligios closed 5 years ago

andrea-ligios commented 6 years ago

Fixed Google Map's URL scheme (from http to https) to make it work again

kth022 commented 6 years ago

What exactly do I need to change in the contact_me.php file? I included the email address of the client, put the form live on the internet but still not receiving anything.

Can someone please help?

Keith

zeufparis commented 6 years ago

Hi kth022, in the contact_me.php file, you just have to put YOUR email address in the $to and $headers variable :

$to = 'your email address';
$headers = 'your noreply email address';

The other datas come from the HTML form. Do you have a personal or a pro server ? Personal -> Check your php.ini and the SMTP configuration (but your ISP could block the SMTP port). Pro -> It should work (unless you have a really bad hosting service). In both case, create a test.php to test your mail function, something like :

<?php
$v = false;
if ( mail( _parameters_ ) )
  $v = true;
echo $v;

php mail parameters : mail

Good luck

kth022 commented 6 years ago

Hi Zeuf,

This is my first time using or trying to use PHP. Im attaching a screenshot of my code. Can you see where the problem is?

[Image]

Thanks, Keith

Get Outlook for Androidhttps://aka.ms/ghei36


From: Zeuf Paris notifications@github.com Sent: Wednesday, March 7, 2018 4:08:35 PM To: BlackrockDigital/startbootstrap-modern-business Cc: kth022; Comment Subject: Re: [BlackrockDigital/startbootstrap-modern-business] Update contact.html (#33)

Hi kth022, in the contact_me.php file, you just have to put YOUR email address in the $to and $headers variable :

$to = 'your email address'; $headers = 'your noreply email address';

The other datas come from the HTML form. Do you have a personal or a pro server ? Personal -> Check your php.ini and the SMTP configuration (but your ISP could block the SMTP port). Pro -> It should work (unless you have a really bad hosting service). In both case, create a test.php to test your mail function, something like :

<?php $v = false; if ( mail( parameters ) ) $v = true; echo $v;

php mail parameters : mailhttp://php.net/manual/en/function.mail.php

Good luck

— You are receiving this because you commented. Reply to this email directly, view it on GitHubhttps://github.com/BlackrockDigital/startbootstrap-modern-business/pull/33#issuecomment-371168191, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AgJq3PHM4bPoywyPDKHaqoGrufCnLDqoks5tb_e9gaJpZM4RaoJy.

kth022 commented 6 years ago

How about now...


From: Zeuf Paris notifications@github.com Sent: Wednesday, March 7, 2018 7:02 PM To: BlackrockDigital/startbootstrap-modern-business Cc: kth022; Comment Subject: Re: [BlackrockDigital/startbootstrap-modern-business] Update contact.html (#33)

I can not see the picture....

— You are receiving this because you commented. Reply to this email directly, view it on GitHubhttps://github.com/BlackrockDigital/startbootstrap-modern-business/pull/33#issuecomment-371247210, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AgJq3MJwuwpDgiC6KH759Gts81_5fMnlks5tcC7JgaJpZM4RaoJy.

zeufparis commented 6 years ago

I can't see anything... Please use another forum and let me know

kth022 commented 6 years ago

This is my actual code...

<?php
 // Check for empty fields
 if(empty($_POST['name'])      ||
  empty($_POST['email'])     ||
  empty($_POST['phone'])     ||
  empty($_POST['message'])   ||
  !filter_var($_POST['email'],FILTER_VALIDATE_EMAIL))
 {
  echo "No arguments Provided!";
  return false;
 }

$name = strip_tags(htmlspecialchars($_POST['name']));
$email_address = strip_tags(htmlspecialchars($_POST['email']));
$phone = strip_tags(htmlspecialchars($_POST['phone']));
$message = strip_tags(htmlspecialchars($_POST['message']));

 // Create the email and send the message
$to = 'info@myemail.com'; // Add your email address inbetween the '' replacing 
yourname@yourdomain.com - This is where the form will send a message to.
$email_subject = "Website Contact Form:  $name";
$email_body = "You have received a new message from your website contact form.\n\n"."Here are the 
details:\n\nName: $name\n\nEmail: $email_address\n\nPhone: $phone\n\nMessage:\n$message";
$headers = "From: noreply@yourdomain.com\n"; // This is the email address the generated message 
will be from. We recommend using something like noreply@yourdomain.com.
$headers .= "Reply-To: $email_address";   
mail($to,$email_subject,$email_body,$headers);
return true;         
?>
zeufparis commented 6 years ago

Your code is correct so this is not a script problem.. (But doing a strip_tags after a htmlspecialchars is useless. Read the PHP doc for both. And using htmlspecialchars in a mail function is useless : it will display the html entities instead of the real character. You filtered the post email so you don't have to sanitize it also... Check Sanitize filters in the PHP doc too). Good luck ! You can also read this https://securephpwiki.com/index.php/Email_Injection

kth022 commented 6 years ago

wooow dont know a lot about this! But if it's not a script problem. what could it be?

zeufparis commented 6 years ago

Where do you host your website ?

kth022 commented 6 years ago

maltagate.net here in Malta

zeufparis commented 6 years ago

maltagate is your website or your hosting provider ? maltagate.net is hosting in the UK, not in Malta...

kth022 commented 6 years ago

Hosting provider

Get Outlook for Androidhttps://aka.ms/ghei36


From: Zeuf Paris notifications@github.com Sent: Wednesday, March 7, 2018 9:43:28 PM To: BlackrockDigital/startbootstrap-modern-business Cc: kth022; Comment Subject: Re: [BlackrockDigital/startbootstrap-modern-business] Update contact.html (#33)

maltagate is your website or your hosting provider ?

— You are receiving this because you commented. Reply to this email directly, view it on GitHubhttps://github.com/BlackrockDigital/startbootstrap-modern-business/pull/33#issuecomment-371277904, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AgJq3Juz_1HbHnP2LCNNzfdJYuB_obmyks5tcEZwgaJpZM4RaoJy.

zeufparis commented 6 years ago

Well, as I can not get the technical informations of your hosting provider, I can not tell you why your mail function is not working... Ask them. Good luck !

kth022 commented 6 years ago

I checked its Plesk

Get Outlook for Androidhttps://aka.ms/ghei36


From: Zeuf Paris notifications@github.com Sent: Wednesday, March 7, 2018 10:00:28 PM To: BlackrockDigital/startbootstrap-modern-business Cc: kth022; Comment Subject: Re: [BlackrockDigital/startbootstrap-modern-business] Update contact.html (#33)

Well, as I can not get the technical informations of your hosting provider, I can not tell you why your mail function is not working... Ask them. Good luck !

— You are receiving this because you commented. Reply to this email directly, view it on GitHubhttps://github.com/BlackrockDigital/startbootstrap-modern-business/pull/33#issuecomment-371282909, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AgJq3C9qnu8AbWeJN-5-XTXib2SYECcHks5tcEpsgaJpZM4RaoJy.