Web form SMTP authentication with PHPmailer

Information collection is important especially when you need some info from user through the web. Most common interaction is a “Contact” form through website.

If you subscribe to a webhosting service, normally webhosting provider will equip you with capabilities to send mail through form. However, you most likely have to authenticate as a valid email user to ensure you able to send mail through a form (this is to prevent spammers utilizing mail service to sending out mail without authentication).

PHPmailer is very useful script for that purpose. What you need is:

  1.  Download PHP mailer and ensure your webhost provider allow you to send mail through a form (Some of them will not allow you due IP webhosters wan’t to protect their IP address “virginity”.
  2. Modify your class.phpmailer.php and class.smtp.php file match your  mailserver connection information. Eg: smtp  server name, port (especially port. Most ISP will block port 25, so ask your webhoster on alternate port for this purpose. Normally it will be the same with the port that you connect for your mail service with them)
  3. Modify your form to complete the required standard mail transaction. Eg: HELO, body, subject and etc.

Lastly, if you having difficulties, ask your webhoster for their advice. Their experts should be happy to assist you on this.

Leave A Comment

Switch to our mobile site