PHP / Forms

Contact Form

You can add to config.inc.php multiple SMTP email providers (your own hosting, Amazon SES, Mailgun, etc) and the SMTP class will try to send the email using the first available provider. If the first one fail, will try the next one and so on.


Setting up the contact form is not difficult. All default Smarty forms are already able by default to use the PHP. You can add multiple fields to any HTML contact form without doing anything else (PHP script will automatically handle all fields).

1. Open php/config.inc.php
2. Edit $config['sow.smtp:provider_email_list'] array

If you add multiple providers, duplicate any of the array (please pay attention to comma and punctuation). Set 'enabled' to true or false to enable or disable a specific SMTP provider.

Because this is Smarty, you have a config generator so you don't need to deal with plain PHP code.
Generate, save it and replace your php/config.inc.php

Note! You can also set multiple departments by using a <select> in your contact form. If you need multiple email destination for each department (marketing, support, sales, etc), you have to manually edit the config and follow the instructions on how to add a <select>.


$config['sow.smtp:provider_email_list'] 	= array(

		/* 

			1. Private Hosting
		
			Check your cPanel for valid credentials.
			Do not use your own email address.
			Create an address like 'noreply@yourdomain.com'
				so can be used only by the website to send the emails
				from sections like contact form.

		*/
		array( 
			'name'			=> 'My Hosting',				// Informative only
			'enabled'		=> true, 					// true|false

			'host'			=> 'my-smtp-from-cpanel.com',
			'port'			=> 587, 					// 25, 465 or 587
			'type'			=> 'tls',					// secure type: tls or ssl (ssl is deprecated)
			'user'			=> 'noreply@mydomain.com',
			'pass'			=> 'noreply_email_password',
		),




		/* 

			2. 	Amazon SES
				https://aws.amazon.com/ses/
		

			INFORMATIVE LIMITS:
				50.000 emails / day
				14 per seconds
				$0.10 / 1000 emails
				Pay as you go
				~$100 per 1M emails

		*/
		array( 
			'name'			=> 'Amazon SES',				// Informative only
			'enabled'		=> false, 					// true|false

			'host'			=> 'email-smtp.eu-west-1.amazonaws.com',
			'port'			=> 587, 					// 25, 465 or 587
			'type'			=> 'tls',					// secure type: tls or ssl (ssl is deprecated)
			'user'			=> '',
			'pass'			=> '',
		),



		/* 
			Add more if needed, the same format 
			copy/paste an array above and edit.

			Transactional email providers you might like 
			(Smarty has nothing to do with them, we just used them over time for various projects)

				Amazon SES 	https://aws.amazon.com/ses/
				Mailgun: 	https://www.mailgun.com/
				Dendinblue 	https://www.sendinblue.com/
				Sendgrid 	https://sendgrid.com/

		*/

);

									

Config Generator Localhost PHP server required.
Entered data is not saved anywhere, just served for download!

If you use your hosting, go to your cPanel and create an email address - something like noreply@mydomain.com, so only your website can use it. Copy/paste here the SMTP credentials. Do NOT use your own good/official email address.
* drag to change the order + SMTP Provider