CodeIgniter Forums
Sending Emails - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forum-23.html)
+--- Thread: Sending Emails (/thread-37298.html)



Sending Emails - El Forum - 01-05-2011

[eluser]flyenig[/eluser]
My site has a members system.
People registers and their info is saved (username, firstname, lastname, email, etc..)

When users message eachother, i set it so that, they will recieve an email, saying something like "Blah blah blah sent you a message! click here to view it"...

Now im sending emails using CI, and it takes around 7 seconds to send email (thats another problem ill talk about later, i think its my server?).
SO that means that the page is going to change in 7 seconds.

How can I beat this?
THe only way i heard is a cron job, but i dont know how to do cron jobs with CI.

can someone help me?
thank you!


Sending Emails - El Forum - 01-05-2011

[eluser]gyo[/eluser]
There will always be some sort of delay via email.
7 seconds is not that bad.

I would send these "email notifications" only if the user is not currently logged in.
In case the user is logged in, why would you need to notify him/her via email?

Hope it helps!


Sending Emails - El Forum - 01-05-2011

[eluser]smilie[/eluser]
I think, it's ment that page reload takes 7 seconds...

What you could do is store info that mail should be sent in DB and then indeed run cronjob to sent those mails.

Cheers,
Smilie


Sending Emails - El Forum - 01-05-2011

[eluser]flyenig[/eluser]
OK im trying to do what facebook does, when someone sends me a message, I get an email.
but see i understand 7 seconds is not that bad, but i see sites like facebook and other popular sites, and when someone sends me a message, "a message was sent successfully" page is shown right away or something like that.
I dont think when you send a message on facebook, it hangs there for 7 seconds waiting for the email to be sent, and then the a message was sent successfully" page is finally shown or something like that
thats why i think they are using cron. but i dont know how to do cron with CI.

@smilie, thanks for the advice.
do you know how i can do this? run cronjobs, etc.