开发者

A couple problems re: CodeIgniter emailer

开发者 https://www.devze.com 2023-01-03 05:03 出处:网络
I have some problems with the email system for CodeIgniter: First, the emails I send out (registration, confirmations) are getting caught in standard spam filters in gmail开发者_开发技巧 and other m

I have some problems with the email system for CodeIgniter:

  • First, the emails I send out (registration, confirmations) are getting caught in standard spam filters in gmail开发者_开发技巧 and other mail clients. How do I get around this? How do companies like Facebook get their emails through consistently?

  • Second, the mailer is working locally but once we deploy it it no longer runs (doesn't send emails) but all the other forms run just fine. Anyone ever run into a problem like this?

Thanks for all the help!


I can't really answer your first question - it's not specific to CodeIgniter. You just need to make sure your email doesn't look like spam. In short - there's no way of guaranteeing your e-mail will not end up in a spam filter.

As for the second question, I expect your production server needs to be configured properly for email. You probably need to configure CodeIgniter to send email properly. I would suggest setting up an SMTP server (or using an existing one) rather than using the standard PHP mail which I think CodeIgniter uses by default.


Regarding spam, most organisations are very secretive about how they prevent spam (not wanting to publish information which helps the spammers) and in some cases they don't actually know - an obvious examlpe of this is bayesian filtering - but, for example, hotmail use a completely unaccountable army of volunteers to manually classify emails.

Do and get a copy of spamassassin and try to reverse engineer how the standard rules work. Obvious things to check are:

1) AVOIDING LOTS OF CAPITALS

2) don't mention the 'V' word

3) make sure you've got a current and restrictive SPF 1.0 policy published

4) make sure your sending from an address which has A and PTR DNS records

5) Do provide a reply-to and from email address which use your domain in the address

the mailer is working locally but once we deploy it it no longer runs

doesn't send emails

Which? These are 2 totally seperate things. If the code is falling over (if so why have you not provided the error details) then its likely a PHP version issue or a problem with the connection to the MTA (or the PHP mail config).

The latter is a problem with the MTA itself.

99.9% of problems reported as PHP mail failures have nothing to do with PHP and are problems with the MTA.

Enabled detailled error reporting for your MTA and see where it is failing.

C.


You may have to configure the email on your server differently than your local development environment. I've had to in the past.

There are two basic ways that PHP can send mail:

  1. Via a UNIX program called "sendmail" (only on non-Windows servers and only if it is installed - check with your hosting provider)

  2. Via a SMTP server.

If you've configured CodeIgniter to use SENDMAIL, check to ensure that the Sendmail path is correct. Your hosting provider usually provides this somewhere in their online documentation.

If you're using SMTP, you need to make sure that your server can contact the SMTP server. You can do this by logging into the server via SSH and typing "telnet your.smtpserver.com 25". If you get an error message about not being able to connect, you know you have a problem with your hosting provider connecting to your mail server.

I've been able to diagnose this problem by enabling logging on my production server (http://bit.ly/4pprd6) and adding log_message('error', $this->email->print_debugger()) right after I attempt to send a message.

0

精彩评论

暂无评论...
验证码 换一张
取 消