I guess it should be a common technique,
However, I tried the following two options:
1) Using my existing POP3 PHP client to access my local mail account. I am getting a "could not connect". Same code works if I run it with my localhost connecting to GoDaddy's pop3 server
2) Parsing the local mbox file - I can't figure out if I can access it, seems like I can't.
Any good ideas of which approach should be best here?
I'd go with the POP3 option. It should work once you get the right port/host etc.
The other option will result in you duplicating a large part of the functionality already in the mail server, and its quite likely you'll have minor bugs in it resulting in emails not displaying properly, or worse, corruption in the mbox.
If you do go with 2, try to find a library for doing the mbox bit!
Zend Framework has a mail component, that allows you to read from various sources.
Seems like I have this figured out. Shared hosting (GoDaddy specifically) does not allow direct TCP connections anywhere, including their own POP3 server. Looks like I can't be able to access the mbox file directly either. So I figure it is just not going to work.
Thanks all repliers!
Maybe there are OTHER inexpensive shared hosting plans that provide this option...
Related
This is an issue I've encountered several time and haven't yet found a decent solution for:
Sending an e-mail from a webserver on e.g. "domain.com", to info#domain.com which is hosted on an external mail server e.g. Google Mail
In my case I always send from PHP over Apache and often on shared hosting, but I can imagine this is the same case on other frameworks.
These e-mails always seem to be delivered to the local mail server, even if I set the MX records on that server to point to the right external mail server.
A solution for this is to use an external SMTP server, but this isn't always easy when you're working with clients that either need to set-up a new e-mail account on their server and provide the SMTP details or sign-up for a third-party SMTP server.
What is the solution for this? Is there no way around SMTP?
Most emai/MTA server "autoconfigure" themselves. They guess list of local email domains (doimans with locally hosted mailboxes).
In sendmail case you can turn it off adding the following line in sendmail.mc:
define(`confDONT_PROBE_INTERFACES', `True')
Documentation : cf/README - confDONT_PROBE_INTERFACES
I have had the same issue many many times (in my case using PHP on a LAMP stack).
Try/check the following.
If you are using cPanel or similar, set the MX records to the external mailserver (Google apps etc).
Set up an SPF record to allow your hosting website to send email (this way no need to configure SMTP).
This may not be applicable but if you are using something like phpmailer. Set the property $mail->isMail(); so it tries to use your SPF allowed local mail() function to send the email. Sorry for going off into very specific advice, but might help in your particular situation.
Worth checking there are not similarly named local mailboxes on your hosting box.
Hope this helps!
I have an instance of October CMS running on my localhost, and I need to send emails to various internal addresses (within the company I work for) via the Mail configuration using SMTP Method (as requested by my superior). I had emails working fine using the PHP Mail Method with the addition of SSMTP to my system. However, for me to do this I was tunneling emails through my personal Gmail account, and we certainly don't want to do that! (By "we" I really mean "I") So, if anyone has any clues as to how I should go about this, I would greatly appreciate it!
First of all, create your email server.
Windows -> hMailServer
Others systems (Linux) : there are many options, find your best. Google it.
After, foward your port. Check this website, many ads.
Finally, October part. Go to config/mail.php. And change your SMTP server setting to yours.
But, I don't recommand this. Why? Because fowarding port can be dangerous, sometimes. You also have to turn your computer on if people want to reply you.
Instead, use your compagny mail server and change the setting to your compagny. Simple as that (-:.
Hope this help,
FelixINX
Basically I've been asked if there is any way that I can capture & download all incoming and outgoing emails ( preferably in text format ) going through a mail server. This downloading method needs to be done using PHP or similar server side language.
If I can pass the above stage, then the final goal is easily reachable, which is to allow me process the emails via a script of some sort.
If there is any sort of mediating RPM I can install that would allow me to port emails to a directory somewhere, could also be of great help.
I am completely lost on where to start with this, so any sort of pointers or advice is greatly appreciated.
Thanks
Scott
More Info :
Server : CentOS
Mail Server : Pop3
"Downloading" email is the same is fetching email. Have a look at the PHP IMAP extension.
Plenty of examples there to get you going.
I've been googling around for awhile now and have been unable to find any sort of solution or any information at all.
What I need to do is to configure postfix so that when one of our websites sends mail using PHP (via a contact us form or w/e) the mail log will show what the sending website was. This way we can identify a compromised website/form, etc in case one of our IP addresses should get blacklisted. We run virtual hosts so each server could have dozens to hundreds of websites on them. For us to otherwise track them down manually could take forever.
Is this even possible? Perhaps its not if I couldn't find anything on google :(
Consider using PHP 5.3's new mail.log configuration directive. It will allow you to define a log file where all calls to the mail() function are recorded, including the To address, the headers, and the full path to the script that made the call.
If you aren't running 5.3, consider upgrading to it, or to 5.4 once it's out in a few weeks.
Unfortunately this is only half of a solution. There are numerous PHP mail libraries that speak SMTP. If you permit local SMTP connections (as most good web hosting providers should), then users would have a way to bypass that log.
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:
Via a UNIX program called "sendmail" (only on non-Windows servers and only if it is installed - check with your hosting provider)
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.