0

I have this code to send email using smtp, and i got output- Mail sent successfully with following code

ini_set('SMTP', 'mail.veshraj.com.np'); 
ini_set('smtp_port', 465); 
$message = "Hi \n How are you.";
if(mail('veshraj.joshi1@gmail.com', 'Testing Subject for mail function', $message))
{
    echo 'Mail sent successfully';
}

But I did not receive any email, this code is in local machine; If smtp not supported in localhost - then how did frameworks like laravel,yii to do so

Veshraj Joshi
  • 3,544
  • 3
  • 27
  • 45

1 Answers1

1

You are right that you can't send mail on your local host with XAMMP. You need to work on a server that can send mail such as an EC2 instance. Check out: https://laravel.com/docs/5.0/mail and read about how they configure their mail.

They give information how how to send emails to logs instead of recipients as well.

bedtime21
  • 199
  • 8