Jump to content

How to know which email protocol to use w/ CodeIgniter


Recommended Posts

This question may not just be a CodeIgniter related question, but since I am working with CodeIgniter, the context of the question was how I determined where to post.

 

CodeIgniter has an email class, and when using it, it defaults to 'mail' as the protocol. Other options are 'sendmail' and 'stmp'. In my adventures with CodeIgniter, I've never had to configure this option, but on my most recent project, sending email was doing VERY buggy things. Through trial and error, I found that changing the protocol to sendmail was all that was needed to be done to fix everything. What's really weird is that 'mail' would send standard email most of the time, but would never send html email. Also, mail delivery was totally random, and Google wouldn't accept the mail no matter what I did. I was even getting a confirmation (success) message when I used 'mail', so I never thought to change the protocol until a lot of time went by. I initially thought that there was some other problem, like with my controller, or the email content view. Is there a way to look at PHP info and know right away if the server uses mail vs. sendmail ??? I don't want to have to waste so much time with this again!

  • 3 weeks later...

You'll need to know the server and network configuration to know which to use. First of all, CodeIgniter is IMO making a mistake when calling these "protocols". Secondly, I can't see what they mean by "mail" protocol, tried reading here:

 

http://codeigniter.com/user_guide/libraries/email.html

 

Sendmail uses the built in sendmail (usually /var/lib/sendmail) executable on the system to hand the mail over to the server, thereby letting the server deliver the mail on. SMTP delivers the mail directly to some relaying or recipient server using the SMTP protocol. But what is mail? Perhaps it tries to look up MX records for the recipient mail server and deliver the mail directly. Sounds like a really bad idea to me - your web server will most likely be blocked by many recipients as a likely source of spam (ie. untrusted mail server on a variety of metrics).

 

I'd use sendmail if you know the server setup is OK, otherwise SMTP through a mail server you trust. A benefit of sendmail over SMTP is that if there is an issue delivering mail on, the local server will queue and retry the mail, usually up to a week. If the SMTP fails, you have to retry yourself, or just give up.

  • 4 weeks later...

Not to hijack this thread but Say wordpress is able to send emails with out any "valid" mailboxes. out of the box it will send out registration emails. How does that do it and how to impliment it in CI wouldnt it just be a send form without a specified mailbox?

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.