CodeIgniter Forums
Email Issue - 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: Email Issue (/showthread.php?tid=70616)



Email Issue - darkcyde - 05-04-2018

Hi

I'm creating a site, and currently just have a basic holding page with an email subscription form.  I'm hosting the site locally on a LAMP Stack for development, with a host for Production.

The current flow of events is...

User fills out 1 field form supplying email address.
Controller builds an email and sends it to admin email confirming a new subscriber
Controller writes the email address to a simple database table - done so via a Model function.
Controller builds an email and sends it to new subscriber confirming subscription.
User is shown a success page.

On my localhost, everything works as expected, and 2 emails are received - its very simply after all.  It's using the Codeigniter build in email class.

But after uploading everything to the host (and changing the necessary host specific variables), every works EXCEPT sending the FIRST email, so only 1 email received and no errors are reporting in the log (with log threshold set to 1).  I've tried adding in a $this->email->clear() but no change!

If no email worked, or data wasn't written, then I would have said it was a configuration difference between localhost and webhost, but the fact that SOME of it works has gotten me a little baffled.

Anyone got any suggestions?  I'm happy to post code if people need to see it, I just didn't want to flood the post with stuff if someone knows exactly whats going on without needing to see it.

Thanks in advance!

DC


RE: Email Issue - InsiteFX - 05-04-2018

Sounds like it maybe flagging it as a duplicate email and not sending it.

Are the email address the same?


RE: Email Issue - darkcyde - 05-06-2018

Hi - thanks for your reply - I've figured it out!

My localhost was using my Gmail account SMTP to send and receive emails - all worked fine because essentially the emails were sent within the SMTP server, so instantly from outbox to inbox.

When I moved to the host, emails were handled by the hosts SMTP - I had setup my personal Gmail account to send/receive the emails from the host SMTP, maintaining the send from email address as the host rather than my gmail, for convenience so that I receive all my emails in one place. What I had failed to do was setup Gmail to RECEIVE emails from the host SMTP, so I was getting the 1st Email from the SMTP to my personal Gmail when I tested the form, but Gmail wasn't fetching the Email to the host SMTP.....so it was being sent, just not getting all the way thru to my gmail account.

D'oh! This is a result of trying to get everything done late at night when you've only got one left eye open! You live and learn!

Thanks again for your assistance and taking the time to reply - it is VERY much appreciated!!

DC


RE: Email Issue - InsiteFX - 05-06-2018

Your welcome, glad you figured it out.