Send Mail with File Attachment via SMTP using PHP and Jquery




Email has become the most popular Internet service today. Almost all websites have the section where they can either send email messages to their users/clients or where their users/clients can send them message with ease without logging into their email accounts or to avoid the issues of logging into an email account always to send a mail.

If you can observe, you will notice that majority of these websites that have the feature of sending or receiving email messages via their website did their coding using the PHP mail() function that does not use a well configured SMTP Server.

A lot of emails are sent and delivered each day, most are treated as spam messages while others are treated as genuine messages at the receiving end. 

The most important part of an email sent is to see that the message arrives safely at the receiving end.

However, messages sent via the PHP mail() function are treated mostly as spam after so many messages have been sent via this function on a particular server because the mail function is not using a well configured SMTP Server.

Nowadays, Email-Clients and Servers perform massive checks on the emails sending server, like Reverse-DNS-Lookups, Graylisting and whatevs. All this tests will fail with the php mail() function. If you are using a dynamic IP address, the situation will even worse.

The goal of this tutorial is to introduce a secure means through which you can easily send emails with File Attachment via SMTP using PHP and Jquery without the need to log into your email accounts.

A situation where you send a mail to your users/clients or these users/clients happen to contact you via your website and the messages sent are placed in the Spam Box, not all users bother to check their spam box.

This application brings an end to this kind of situation as illustrated above. This application now gives you the hope that all genuine messages sent or received will go straight to your Inbox and no longer the Spam box.

Messages sent via SMTP will always arrive at the receiving end as long as you specify valid information in the configuration file for the application.

The system is also responsive to screen which means that it can be used on any device and also, it can easily be added to any application by simply adjusting the width of the class with the name: ".vpb_main_wrapper" which is already set to width:60%; in the CSS file that comes with the application.

The system can be used as a Contact Form or as a Mailing System depending on your setting in the Config file that comes with this application.

To use this application, you need to specify few details in the config file which comes with the application and such information are as follows:

(1) Outgoing (SMTP) mail server or an SMTP Address: Example; smtp.server-name.com, mail.server-name.com or an IP Address depending on what your server uses

(2) Your SMTP Port Number: Example; 25

(3) Your SMTP Username or an email address created via your hosting control panel: Example; admin@vasplus.info

(4) Your SMTP Password which is the password of the email address you may have specified as your SMTP Username or email address.