Home > Mobile >  Is there a way to send mail in php online?
Is there a way to send mail in php online?

Time:12-22

I can send emails in PHP because I edited the php.ini file the the XAMPP directory. Then I uploaded my PHP file in a free domain, I can't send the email anymore because the php.ini file is obviously for xampp only. How can I send an email on an online domain?

CodePudding user response:

you can use 3rd party services like twilio and use their API to send the mails , you can even send whatsapp messages through that

CodePudding user response:

You can also configure a email sending service for apps like Sendgrid or equivalent in order to be able to send out emails.

Most hosting providers block SMTP port 21 to avoid issues with spammers. The right way to do this is by using such a service I have suggested.

CodePudding user response:

If you want to send mail with php, online, via Gmail...

  1. Setup your project to use Composer.
    https://getcomposer.org/

  2. Add phpmailer to your project through Composer
    https://github.com/PHPMailer/PHPMailer
    composer require phpmailer/phpmailer

  3. Configure your Gmail to be able to use smtp from php
    Little tutorial regarding all described
    https://netcorecloud.com/tutorials/send-an-email-via-gmail-smtp-server-using-php/

Following all the steps, you'll be able to work/use your code in localhost with xampp or online, without changing anything

  • Related