CodeIgniter Forums
Will the real Sendmail demon, please stand up... (SMTP woes) - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Will the real Sendmail demon, please stand up... (SMTP woes) (/showthread.php?tid=18380)

Pages: 1 2


Will the real Sendmail demon, please stand up... (SMTP woes) - El Forum - 05-04-2009

[eluser]smidiod[/eluser]
OK,

so I'm sending mail from CI all tickety-boo and then discover the MTA is not listening in 25. Ah, I thinks, must be me... (googles)

Long story -> short:

* I'm running Sendmail and the system is expecting (Matrix Centos 5) to use Postfix. So I switch back to Postfix using the Redhat switcher and lo, I can receive mail!

I can also send mail -BUT- Postfix is mangling the headers so that a nice HTML formatted message comes out looking like, HTML markup... the mime appears screwed up so what the user sees is actual markup!

The first part of the message looks ike this:

Code:
--B_ALT_49ff652b44da6

Content-Type: text/plain; charset=iso-8859-1

Content-Transfer-Encoding: quoted-printable

=0D
Hello qweqw qweqe,Someone (we hope it was you) entered this email address=


and the HTML section:

Code:
--B_ALT_49ff652b44da6

Content-Type: text/html; charset=iso-8859-1

Content-Transfer-Encoding: quoted-printable

&lt;html&gt;&lt;head>&lt;/head&gt;&lt;body><p>Hello qweqw qweqe,</p><p>Someone (we hope it wa=

Switch back to Sendmail and I can send OK from CI (as expected) BUT can't receive because Sendmail isn't listening any more...

I don't have much hair left - anyone got any ideas?


Will the real Sendmail demon, please stand up... (SMTP woes) - El Forum - 05-04-2009

[eluser]Charles Garrison[/eluser]
Can you share your CI code please?


Will the real Sendmail demon, please stand up... (SMTP woes) - El Forum - 05-05-2009

[eluser]smidiod[/eluser]
Yes of course, I would have done this sooner, but oddly, I didn't get an email notification of your reply:

Code:
/*
*
* For brevity, I've removed the access to the model
* access where some of the information (address, subject, etc.)
* is stored. Some of these emails may optionally contain an attachment.
* hence the $this->email->clear(TRUE) at the end.
*
*/
$config['crlf'] = "\r\n";
$config['newline'] = "\r\n";
$config['mailtype'] = "html";
$this->email->initialize($config);
$this->email->clear(TRUE);
$this->email->from('[email protected]', 'Faircycle');
$row = $this->emails_model->get_email($mail_number);
$body  = "&lt;meta http-equiv=\"content-type\" content=\"text/html; charset=utf-8\" /&gt;\n";
$body .= "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\"\n";
$body .= "\"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n";
$body .= "&lt;html&gt;";        
$body .= "<p>Dear $name,</p>$row->body";
$body .= "&lt;/html&gt;";
$this->email->message("$body");
$this->email->to($email);
$this->email->subject($row->subject);
$this->email->send();    
$this->email->clear(TRUE);

I don't really see this is a CI problem more one relating to Postfix which is messing around with CI's formatting.

The annoying thing is I can't switch Matrix to Sendmail (using the shell) without screwing up INCOMING mail. This may, of course, be a Centos problem.


Will the real Sendmail demon, please stand up... (SMTP woes) - El Forum - 05-05-2009

[eluser]TheFuzzy0ne[/eluser]
Are you unable to use SMTP?


Will the real Sendmail demon, please stand up... (SMTP woes) - El Forum - 05-05-2009

[eluser]smidiod[/eluser]
Tricky to explain, but here goes.

With Postfix (default on a Matrix Centos appliance server) I can send from and receive email as normal, but CI's mails get mangled.

With Sendmail - and Exim - (both installed later) I can only send but CI's outgoing mails are received untouched and as I intended them.

Unfortunately, I need to send and receive mail on this server... perhaps there's something in the Postfix configuration that can be altered to stop it messing with CI's mails?

p.s.
When Exim/Sendmail are running they fail to bind to 25 to listen for incoming messages: I have no idea why. If I can fix this, I can bin Postfix and we're good to go. However, this appears to be a bit of a gotcha for other users if they don't have the option. I'm fortunate enough to have a dedicated server on this project.


Will the real Sendmail demon, please stand up... (SMTP woes) - El Forum - 05-05-2009

[eluser]TheFuzzy0ne[/eluser]
This is a very complex problem. I can only suggest that you try sending the Email using straight PHP, and see if the problem persists. That should tell you whether it's something to do with CodeIgniter or your server setup. If it's the latter, you'll need to contact your server admins.


Will the real Sendmail demon, please stand up... (SMTP woes) - El Forum - 05-05-2009

[eluser]smidiod[/eluser]
It's a server problem, for sure, that much was never really in doubt. The problem with the server admin is he's an idiot.

I see him every morning in the mirror. :-)


Will the real Sendmail demon, please stand up... (SMTP woes) - El Forum - 05-05-2009

[eluser]TheFuzzy0ne[/eluser]
Yeah, I seem to see that idiot in the mirror each morning also... He sure get's around!

Unfortunately, I think you might be in the wrong forum for such a question. However, what distro are you running? I might be able to dig out a guide for you, but it will probably involve starting with a clean OS install.


Will the real Sendmail demon, please stand up... (SMTP woes) - El Forum - 05-05-2009

[eluser]smidiod[/eluser]
He sure does!

It's Centos 5.x. Not sure which subversion, though. I've done clean wipe and it persists. I rather suspect the problem is entirely down to Postfix or the PF configuration. Matrix appliances who make the things are not exactly, er, "visible" on the web. Which is odd, because they seem to get around a bit.

I'll try a Centos forum, I thought I'd have a go here since it affects us all.

Marc

PS

Those 8 "P's"... very true. This is why I'm still TESTING Faircycle's servers when we should have launched weeks ago... LOL.


Will the real Sendmail demon, please stand up... (SMTP woes) - El Forum - 05-05-2009

[eluser]TheFuzzy0ne[/eluser]
This might help. http://www.howtoforge.com/perfect_setup_centos5.0

I swear by their guide for setting up Debian.