Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Looking for Email Form script recommendations for PHP / Desktop+Mobile (with or without jQuery enhancements)

Engaged ,
Mar 26, 2019 Mar 26, 2019

I've been working on my first website in years (following a self-imposed break from online dev) and had a lot of catching up to do. Before the break, designing for mobile was a secondary concern. Sites were a lot more static. Bootstrap wasn't widely-used, but jQuery was. And CSS animations weren't as casual a thing as they are today.

That being said, I'm glad to say that with the help of the superheroes in this sub (some of whom have been selflessly helping ordinary citizens since the Macromedia Usenet days) I've caught up to the important stuff, and am now at the final stage of the site's development : the contact form.

For context, all my pages are PHP (I like using PHP includes to assemble the head+body+foot) and I'm already linking to jQuery for my lightbox (so it can be jQuery-dependent if required). And NancyO reminded me a while back that the form needs to be mobile-responsive as well.

So what I'm looking for, then, would be a PHP-based, mobile-friendly script that may or may not also use jQuery enhancements (especially if I can control them). I feel like there are thousands of free form scripts out there and it's not always clear what they're built for (the language is sometimes a little over my head).

My needs could not be more basic : "Want to drop me an email? Here's a form."

Do you guys have a favorite to recommend in 2019?

(After this, I think I'm done!)

1.3K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

LEGEND , Mar 28, 2019 Mar 28, 2019

https://forums.adobe.com/people/Under+S.  wrote

osgood_   wrote

Yes, that's the one.

Not to seem ungrateful (because not even Dreamhost wants to waste their time on this one with me, as "this goes a little beyond the scope of support we provide") but I'm finding it difficult to stay focused on this thing's pace; which is probably why I tend to avoid video tutorials in general. Is there a text version of it somewhere with code I can just copy/paste, test-drive and deconstruct?

Under the video there i

...
Translate
Community Expert ,
Mar 26, 2019 Mar 26, 2019

PHP Mailer from Github is the one everyone uses these days.   It's safe, secure and works with or without a PHP mail server.  

GitHub - PHPMailer/PHPMailer: The classic email sending library for PHP

Nancy O'Shea— Product User, Community Expert & Moderator
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Mar 26, 2019 Mar 26, 2019

https://forums.adobe.com/people/Nancy+OShea  wrote

PHP Mailer from Github is the one everyone uses these days.   It's safe, secure and works with or without a PHP mail server.  

GitHub - PHPMailer/PHPMailer: The classic email sending library for PHP

Always seemed a bit of a nightmare to set up to me, so I never pursued it, opting for the easier to set up php mail() function assuming the host has that function set to on, all my hosts do.

Presumably you still have to set up the validation of the form fields yourself before you hand the information off to the phpMailer script?

The actual example code at the GitHub page is once again poor as it doesnt address how to get information out of the form but just hard code some crap information, which I'm sure is pretty useless to anyone. I have zero idea why they show such bad examples as default.

Also not many want to use composer to get the f•••ing scripts onto their computer - they hide away the most helpful option (to download the zip file) in the text. What idiot writes this boll*cks.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 26, 2019 Mar 26, 2019

PHp Mailer is not just some simple copy & paste script.  It's an actual PHP sending library. capable of handling almost any scenario.  

The Zip file download

https://github.com/PHPMailer/PHPMailer/archive/master.zip

To see what all you can do, open the  Examples folder.

osgood_  wrote

Always seemed a bit of a nightmare to set up to me, so I never pursued it, opting for the easier to set up php mail() function assuming the host has that function set to on, all my hosts do.

Unfortunately,  PHP Mail () function has gone out of favor.  Most hosts discourage its use.  They frequently recommend PHP Mailer though because it's very flexible.

Nancy O'Shea— Product User, Community Expert & Moderator
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Mar 26, 2019 Mar 26, 2019

https://forums.adobe.com/people/Nancy+OShea  wrote

PHp Mailer is not just some simple copy & paste script.  It's an actual PHP sending library. capable of handling almost any scenario.  

Some might says its overkill for a simple form. Its difficult to judge these days as devs seems to be complicating all kinds of processes which should be simple. For some reason I can't figure that out yet, I'm consistently working to find the answer.

https://forums.adobe.com/people/Nancy+OShea  wrote

Unfortunately,  PHP Mail () function has gone out of favor.  Most hosts discourage its use.  They frequently recommend PHP Mailer though because it's very flexible.

Well its still being taught in current tutorials so I wouldnt write it off for a simple web form solution or for a more complex one just because some nerdy dev says so. Many a workflow have apparently gone out of fashion according to nerdy devs - php itself.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Mar 27, 2019 Mar 27, 2019

osgood_  wroteNancy OShea

Well its still being taught in current tutorials so I wouldnt write it off for a simple web form solution or for a more complex one just because some nerdy dev says so. Many a workflow have apparently gone out of fashion according to nerdy devs - php itself.

Dreamhost seems to offer both PHPmail + PHPmailer natively to their clients. I'm usually tempted to go with the new wave, but at this point it'll be whichever one I can get working more quickly.

I also have no preference between using DH's version or installing my own, beyond the fact that I am clearly out of my depth on this one. I would assume installing my own allows me to more easily transfer the site away from DH should the need someday arise, but maybe just getting it working is what's called for given my noob-ness.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Mar 27, 2019 Mar 27, 2019

Google - traversy media php contact form - the youtube video is a couple of years old but still relevant for using the php mail() function method. The process is explained very clearly with easy to follow coding.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Mar 27, 2019 Mar 27, 2019

https://forums.adobe.com/people/Nancy+OShea  wrote

PHP Mailer from Github is the one everyone uses these days.   It's safe, secure and works with or without a PHP mail server.  

GitHub - PHPMailer/PHPMailer: The classic email sending library for PHP

Unfortunately, dropping me in front of a GitHub link is like dropping a child in front of a highway. I have no idea what to do next without installation notes.

EDIT: Is this the same "PHPMailer" you're referring me to? Dreamhost seems to offer it natively. And there appears to be instructions, although this PHP stuff is quite intimidating to even look at.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Mar 27, 2019 Mar 27, 2019

https://forums.adobe.com/people/Under+S.  wrote

EDIT: Is this the same "PHPMailer" you're referring me to? Dreamhost seems to offer it natively. And there appears to be instructions, although this PHP stuff is quite intimidating to even look at.

Yes, its the same phpMailer.

If you find it a bit daunting then find out if your host supports the php mail() function. There are plenty of decent tutorials on youtube that can guide you through setting up a simple feedback form using that, which might be a bit less overwhelming.

Usually things look more complex than they actually are, the poor documentation and examples provided are not helpful. You might do well to look up some youtube videos relating to using phpMailer if you choose that option.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Mar 27, 2019 Mar 27, 2019

osgood_  wrote

Yes, its the same phpMailer.

Rightly or wrongly, someone just told me both those tools (PHPmail + PHPmailer) are for SENDING emails en masse (as in, spamming the population) and not for use as a simple contact form on a website. Which might explain why my eyes got so wide looking at that PHP code.

Just so we're 100% clear, I'm simply looking to let people contact me via my website -- in other words, receive -- not send. They don't need to be able to attach files, format the text in any way (plain text is fine)... just basic 'contact me' stuff.

All it really needs to do better than the next tool is handle the usual eventualities (like missing fields or improper email address syntax) as elegantly as possible; ideally without page-refreshing.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Mar 27, 2019 Mar 27, 2019

https://forums.adobe.com/people/Under+S.  wrote

Rightly or wrongly, someone just told me both those tools (PHPmail + PHPmailer) are for SENDING emails en masse (as in, spamming the population) and not for use as a simple contact form on a website. Which might explain why my eyes got so wide looking at that PHP code.

No, wrong, they dont send emails en masse.

phpMailer is a mailing library. You can use as much of it or as little as you want. It included options like the ability to send attachments easily via the mailing form etc

The php mail() function is a bare bones mailing solution. It has no default options to send attachments unless you write additional code, which can get complex, phpMailer supposedly makes it easier as its an option which is part of the library.

Just so we're 100% clear, I'm simply looking to let people contact me via my website -- in other words, receive -- not send. They don't need to be able to attach files, format the text in any way (plain text is fine)... just basic 'contact me' stuff.

Both options will allow you to do that. Some hosts dont offer the php mail() function as supposedly sending by smtp is less troublesome in terms of spam and security issues. I cant say l have had any issues myself regarding the php mail() function which wasnt of my own making i.e. failing to include some kind of anti spam features such as a question/answer or captcha which is recommended to stop bots from populating the form fields and sending the spam.

If you do view the video l recomended in my previous post please dont think you have to use Bootstrap. The instructor is only using that as a way of styling the form. You just need to take note of the php code.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Mar 27, 2019 Mar 27, 2019

osgood_  wrote

If you do view the video l recomended in my previous post please dont think you have to use Bootstrap. The instructor is only using that as a way of styling the form. You just need to take note of the php code.

Google did not turn up any pages with the exact name you asked me to search for, but the first video result was this :

PHP Front To Back [Part 15] - PHP Contact Form - YouTube

Is this what you want me to watch?
(I'm so old-school, I'm used to text tutorials still; this will be an adjustment.)

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Mar 27, 2019 Mar 27, 2019

https://forums.adobe.com/people/Under+S.  wrote


Google did not turn up any pages with the exact name you asked me to search for, but the first video result was this :

PHP Front To Back [Part 15] - PHP Contact Form - YouTube

Is this what you want me to watch?
(I'm so old-school, I'm used to text tutorials still; this will be an adjustment.)

Yes, that's the one.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Mar 28, 2019 Mar 28, 2019

osgood_  wrote

Yes, that's the one.

Not to seem ungrateful (because not even Dreamhost wants to waste their time on this one with me, as "this goes a little beyond the scope of support we provide") but I'm finding it difficult to stay focused on this thing's pace; which is probably why I tend to avoid video tutorials in general. Is there a text version of it somewhere with code I can just copy/paste, test-drive and deconstruct?

Going back to Nancy OShea​'s suggestion, is this what I need to be looking at if all I'm looking to do is set up a simple HTML contact form that'll send me an email on form submit, and know how to handle simple errors like mandatory fields?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Mar 28, 2019 Mar 28, 2019
LATEST

https://forums.adobe.com/people/Under+S.  wrote

osgood_   wrote

Yes, that's the one.

Not to seem ungrateful (because not even Dreamhost wants to waste their time on this one with me, as "this goes a little beyond the scope of support we provide") but I'm finding it difficult to stay focused on this thing's pace; which is probably why I tend to avoid video tutorials in general. Is there a text version of it somewhere with code I can just copy/paste, test-drive and deconstruct?

Under the video there is a 'show more' link. If you cick on that there is a download link to the code.

https://forums.adobe.com/people/Under+S.  wrote

Going back to https://forums.adobe.com/people/Nancy+OShea 's suggestion, is this what I need to be looking at if all I'm looking to do is set up a simple HTML contact form that'll send me an email on form submit, and know how to handle simple errors like mandatory fields?

No. That shows an example of deploying PHPMailer using 'Composer',  a workflow where you would be using the terminal to set up the PHPMailer script but first you have to install 'Composer' on your machine....too much trouble in my opinion unless you're a nerdy type.  If you are going to use PHPMailer I suggest you download the zip file to which Nancy supplied a link to in post No. 3. However you still have work to do because PHPMailer alone contains no form validation apart from exiting the script if a non-valid email is supplied, which means the user gets delivered a blank page instead of a message saying the email is invalid. You need to code the validation of the form fields prior to handing the information being collected off to the PHPMailer script. Of course you can use the script without any validation but you risk getting spam.

The youtube video I posted a link to, which uses the php mail() function instead, includes validation of the email field and some sanitisation of the form fields to stop undesired characters being injected into the form fields. Of course html5 has its own email validation <input type="email"> which wont let the form be submitted unless a valid email is supplied, so you could use that if you only wanted to validate the email form field.

When I say valid email I mean any email that's formatted like an email, the email doesnt have to exist so its no protection against spam, you will more than likely need to introduce a form captcha or a question/answer form field BUT I would for now just concentrate on getting the basic form up and running as they can be introduced later.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines