Mailing List Archive
tlug.jp Mailing List tlug archive tlug Mailing List Archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]Re: [tlug] Testing email functions within PHP on my local machine
- Date: Thu, 05 Jul 2007 00:45:16 +0900
- From: "Stephen J. Turnbull" <stephen@example.com>
- Subject: Re: [tlug] Testing email functions within PHP on my local machine
- References: <7d27112b0707031859r13c1530fmc80518abe667de0f@mail.gmail.com> <468B03C8.7050506@dcook.org> <d8fcc0800707032317g76241670of4719e195017431@mail.gmail.com> <7d27112b0707040043o30f62731g3812169203d72078@mail.gmail.com> <7d27112b0707040125j5ebe5241x980f923099dde1df@mail.gmail.com> <20070704103611.00873a67.gstewart@bonivet.net> <7d27112b0707040333o1715f109s85f668bab1a723a5@mail.gmail.com> <20070704123925.1dea5589.gstewart@bonivet.net> <7d27112b0707040519i27ceefb0r44818f9de990acc8@mail.gmail.com>
Dave Gutteridge writes: > With cryptic tutorials on the net with phrases like "enable SMTP > AUTH for Postfix", as if that is supposed to be a self standing > instruction, this is beyond both my ability and the scope of my > endeavors. I'm just trying to get PHP to send an email, not become > an sendmail protocol administrator. Gah. SMTP is hard, true, but only because it really is simple. So simple that it is defenseless against the buccaneers on the Internet. If you keep everything on the local box, though, it's perfectly safe, and simple to use. I don't know of any installations that prevent local delivery, so you just set it up as the default and let the firewall keep the pirates out. I would advise staying away from Sendmail, just because it's notoriously cryptic and hard to configure. Use Exim or Postfix. Yeah, I know you already installed Sendmail; it may well be worth uninstalling it and using something with a more modern configuration system. You may configure it to start a server daemon. Usually something like /etc/init.d/postfix start will do that by hand, and you may prefer that if you don't want it running by default since you don't need it. You'll also need to shut it down by hand in that case. Configure the firewall to block all connections from outside of your box to port 25. Make sure localhost can get through to it, of course. In iptables, something like iptables -A INPUT -p tcp -s 127.0.0.1 -d 127.0.0.1 --dport 25 -j ACCEPT iptables -A INPUT -p tcp --dport 25 -j REJECT should probably work. Test that it works from that machine with telnet localhost 25, and that is doesn't work from another machine with telnet thatbox 25. "Working" looks like this: steve@example.com ~ $ telnet localhost 25 Trying 127.0.0.1... Connected to localhost. Escape character is '^]'. 220 uwakimon.sk.tsukuba.ac.jp ESMTP Postfix QUIT 221 2.0.0 Bye Connection closed by foreign host. steve@example.com ~ $ (you type the QUIT to shut down the connection cleanly). "Not working" looks like this: chibi:MacPorts steve$ telnet localhost 25 Trying ::1... telnet: connect to address ::1: Connection refused Trying 127.0.0.1... telnet: connect to address 127.0.0.1: Connection refused chibi:MacPorts steve$ (You may not see two attempts, but only one; it depends on whether your box and telnet are configured to do IPv6.) Configure an alias (often in /etc/aliases, but see your MTA's docs) as test: dave Where "test" is any name you will recognize as testing your PHP script, and "dave" is the account name you are using on that box. Run the newaliases command (you'll probably need to su or sudo). Then use "test", "test@example.com", or "test@example.com" as the test address in your PHP script. (Cut-and-try; any of those might fail depending on the configuration of your mailer, but the simplest, just "test", is quite likely to work.) Also test those from your local MUA.
- References:
- [tlug] Testing email functions within PHP on my local machine
- From: Dave Gutteridge
- Re: [tlug] Testing email functions within PHP on my local machine
- From: Darren Cook
- Re: [tlug] Testing email functions within PHP on my local machine
- From: Josh Glover
- Re: [tlug] Testing email functions within PHP on my local machine
- From: Dave Gutteridge
- Re: [tlug] Testing email functions within PHP on my local machine
- From: Dave Gutteridge
- Re: [tlug] Testing email functions within PHP on my local machine
- From: Godwin Stewart
- Re: [tlug] Testing email functions within PHP on my local machine
- From: Dave Gutteridge
- Re: [tlug] Testing email functions within PHP on my local machine
- From: Godwin Stewart
- Re: [tlug] Testing email functions within PHP on my local machine
- From: Dave Gutteridge
Home | Main Index | Thread Index
- Prev by Date: Re: [tlug] Kernel Code Reading Party of YLUG
- Next by Date: [tlug] iptables - Tools for easy configuration
- Previous by thread: Re: [tlug] Testing email functions within PHP on my local machine
- Next by thread: Re: [tlug] Testing email functions within PHP on my local machine
- Index(es):
Home Page Mailing List Linux and Japan TLUG Members Links