![]() |
Sending email from gmail - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5) +--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24) +--- Thread: Sending email from gmail (/showthread.php?tid=75525) |
Sending email from gmail - hmvartak - 02-16-2020 I'm trying to send an email from my gmail account to some other gmail address. But my code doesn't seem to work at all. PHP Code: $config = array( I have allowed less secure apps to access gmail. Also I'm executing this script on local computer. My PHP version is 7.2.11. Codeigniter version is 3.1.10 RE: Sending email from gmail - jreklund - 02-16-2020 You should run the debug tool. It will tell you want's wrong. https://codeigniter.com/user_guide/libraries/email.html RE: Sending email from gmail - hmvartak - 02-16-2020 Debugger says this. Code: 220 smtp.gmail.com ESMTP y24sm14013191pge.72 - gsmtp My php.ini is like this Code: [mail function] RE: Sending email from gmail - InsiteFX - 02-16-2020 PHP Code: $config['protocol'] = 'smtp'; Try that. RE: Sending email from gmail - hmvartak - 02-16-2020 (02-16-2020, 04:37 AM)InsiteFX Wrote: That worked! Actually I had seen that example on stackoverflow. But used to remove the variable $config['newline'] = "\r\n", which seems to be crucial. Also smtp_host must be in the format in example. (I had used smtp.gmail.com, which works in PHPMailer script but not in codeigniter) Thanks! RE: Sending email from gmail - Corsari - 04-04-2021 For those that are searching an updated tutorial Published march the 31 in 2021 check out this one https://www.positronx.io/codeigniter-send-email-with-smtp-tutorial-with-example/ WARNING: for those of you who can't succeed in the SMTP authentication since I've lost some time on this issue For the sake of avoid somebody else to loose time If you can't authenticate, read carefully the messages with the debug options I have been deceived by these authentication errors end it ended up with being the connection ports 465 and 587 being not accessible from my computer to remote SMTP server e.g. xampp in windows well, the issue was Avast antivirus and with modern antiviruses the issue could happen either with third party antiviruses So in the case you can't send emails, a quick troubleshoot is to disable antivirus and make a test |