How to send email from localhost in php

Spread the love

Hi Folks I know you have faced so many problem sending email from your localhost server XAMPP,WAMP,LAMP because when you setup apache in local system it won’t setup SMTP server for you.So if you want to send mails from your localhost server then you have to setup SMTP in your php.ini file or you need to use external SMTP server.There are a lot of external SMTP servers like GMAIL,HOTMAIL,YAHOO and so more.They Permit you to send emails using their SMTP setup you just need to configure some parameter in your local configuration or in your phpmailer code.

how to send mail from localhost, how to send mail from localhost in php wamp, how to send mail in php code, php code for sending email using localhost, send mail from localhost xampp using gmail, send mail using phpmailer from localhost

If you are going to use Gmail SMTP server, you need to change account access for less secure apps By doing following steps.
1. Login to your google account.
2. Go to the Less secure apps settings page https://www.google.com/settings/security/lesssecureapps
3. From Access for less secure apps section, select Turn on.

First download latest phpmailer class form here https://github.com/PHPMailer/PHPMailer

After that include PHPMailerAutoload.php on your mailing page and configuring SMTP settings.

Sending attachment on emails

PHPMailer allow you send multiple attachment on email by adding following lines on your mailer code.

By utilizing above technique you can undoubtedly send email from localhost without changing in your php configuration files, It is better thought to test all emailing system in your project locally and afterward moved completely furnished project on production this will unquestionably diminish your project implementation time, Hope this will help you to send email from local

Leave a Reply

Your email address will not be published. Required fields are marked *