My development machine (WinXP, Apache 2.2.4) does not have an smtp
server, and I don't really want to install one if I can help it.
Does anyone know of a simple method of testing php scripts that employ
mail() by simulating an smtp server and directing output to a text file
or to an installed text editor.
Right now I can modify the script to use something instead of mail(),
then change it when I put into production, but I would really like to
test the script in its production form w/o having to actually send email.
Bill 17 3763
On Sun, 17 Jun 2007 17:05:43 +0200, William Gill <no*****@gcgroup.net>
wrote:
My development machine (WinXP, Apache 2.2.4) does not have an smtp
server, and I don't really want to install one if I can help it.
Don't need to, just use any SMTP server you like, it's not like working
with sockets on UNIX. Local, ISP, doesn't matter.
Does anyone know of a simple method of testing php scripts that employ
mail() by simulating an smtp server and directing output to a text file
or to an installed text editor.
Right now I can modify the script to use something instead of mail(),
then change it when I put into production, but I would really like to
test the script in its production form w/o having to actually send email.
Why go to the trouble of simulating an SMTP server? Define a function
my_mail(), let it log to a file while testing, let it call mail() on
production, and you're set. Just one little change ( or pehaps even make
the function behaviour dependend on some enivronmental variables so it
automatically chooses the right action.
--
Rik Wasmus
That works, but then I need to go pull the email (assuming I was on the
original distribution) and verify everything was as expected. If I
could simulate the smtp server I could check the format and content
regardless of who it's actually sent to.
Bill
Rik wrote:
On Sun, 17 Jun 2007 17:05:43 +0200, William Gill <no*****@gcgroup.net>
wrote:
>My development machine (WinXP, Apache 2.2.4) does not have an smtp server, and I don't really want to install one if I can help it.
Don't need to, just use any SMTP server you like, it's not like working
with sockets on UNIX. Local, ISP, doesn't matter.
>Does anyone know of a simple method of testing php scripts that employ mail() by simulating an smtp server and directing output to a text file or to an installed text editor.
Right now I can modify the script to use something instead of mail(), then change it when I put into production, but I would really like to test the script in its production form w/o having to actually send email.
Why go to the trouble of simulating an SMTP server? Define a function
my_mail(), let it log to a file while testing, let it call mail() on
production, and you're set. Just one little change ( or pehaps even make
the function behaviour dependend on some enivronmental variables so it
automatically chooses the right action.
--Rik Wasmus
On Sun, 17 Jun 2007 18:58:34 +0200, William Gill <no*****@gcgroup.net>
wrote:
That works, but then I need to go pull the email (assuming I was on the
original distribution) and verify everything was as expected. If I
could simulate the smtp server I could check the format and content
regardless of who it's actually sent to.
Or you could 'override' the 'to' (CC/BCC) fields in you
my_mail()-function, so it'll always be sent to you, possibly with the
original emailadresses in another header/in the content.
--
Rik Wasmus
William Gill wrote:
My development machine (WinXP, Apache 2.2.4) does not have an smtp
server, and I don't really want to install one if I can help it.
Does anyone know of a simple method of testing php scripts that employ
mail() by simulating an smtp server and directing output to a text file
or to an installed text editor.
I have the following in my php.ini
sendmail_path = php -r
"file_put_contents('c:/mail.log',file_get_contents('php://stdin'),FILE_APPEND);"
this logs all emails sent via mail() to c:\mail.log
--
gosha bine
extended php parser ~ http://code.google.com/p/pihipi
blok ~ http://www.tagarga.com/blok
That's a thought! It still means going to mail to see the result, but
using IMAP I could leave that window open while I test.
I just have to remember to always use the my_mail() wrapper instead of
mail().
Thanks,
Bill
Rik wrote:
On Sun, 17 Jun 2007 18:58:34 +0200, William Gill <no*****@gcgroup.net>
wrote:
>That works, but then I need to go pull the email (assuming I was on the original distribution) and verify everything was as expected. If I could simulate the smtp server I could check te format and content regardless of who it's actually sent to.
Or you could 'override' the 'to' (CC/BCC) fields in you
my_mail()-function, so it'll always be sent to you, possibly with the
original emailadresses in another header/in the content.
--Rik Wasmus
..oO(gosha bine)
>William Gill wrote:
>> Does anyone know of a simple method of testing php scripts that employ mail() by simulating an smtp server and directing output to a text file or to an installed text editor.
I have the following in my php.ini
sendmail_path = php -r "file_put_contents('c:/mail.log',file_get_contents('php://stdin'),FILE_APPEND);"
this logs all emails sent via mail() to c:\mail.log
Nice idea ...
Micha
Looks good, but it causes a parsing error on WinXP. I may use it on my
Linux boxes though.
Bill
gosha bine wrote:
William Gill wrote:
>My development machine (WinXP, Apache 2.2.4) does not have an smtp server, and I don't really want to install one if I can help it.
Does anyone know of a simple method of testing php scripts that employ mail() by simulating an smtp server and directing output to a text file or to an installed text editor.
I have the following in my php.ini
sendmail_path = php -r
"file_put_contents('c:/mail.log',file_get_contents('php://stdin'),FILE_APPEND);"
this logs all emails sent via mail() to c:\mail.log
William Gill wrote:
Looks good, but it causes a parsing error on WinXP. I may use it on my
Linux boxes though.
Works just fine for me. Make sure you've copied it properly.
Also, please do not top-post. Post your replies below the quoted text.
>
Bill
gosha bine wrote:
>William Gill wrote:
>>My development machine (WinXP, Apache 2.2.4) does not have an smtp server, and I don't really want to install one if I can help it.
Does anyone know of a simple method of testing php scripts that employ mail() by simulating an smtp server and directing output to a text file or to an installed text editor.
I have the following in my php.ini
sendmail_path = php -r "file_put_contents('c:/mail.log',file_get_contents('php://stdin'),FILE_APPEND);"
this logs all emails sent via mail() to c:\mail.log
--
gosha bine
extended php parser ~ http://code.google.com/p/pihipi
blok ~ http://www.tagarga.com/blok
gosha bine wrote:
William Gill wrote:
>Looks good, but it causes a parsing error on WinXP. I may use it on my Linux boxes though.
Works just fine for me. Make sure you've copied it properly.
Fixing the cut and paste error, and commenting out the "SMTP =" and
'smtp_port =' entries fixed the parse error. Now Xp is complaining
about php not being a recognized command when it's called from inside
Apache.
I'll keep fiddling with it.
Also, please do not top-post. Post your replies below the quoted text.
Mea culpa.
>
>> Bill
gosha bine wrote:
>>William Gill wrote: My development machine (WinXP, Apache 2.2.4) does not have an smtp server, and I don't really want to install one if I can help it.
Does anyone know of a simple method of testing php scripts that employ mail() by simulating an smtp server and directing output to a text file or to an installed text editor.
I have the following in my php.ini
sendmail_path = php -r "file_put_contents('c:/mail.log',file_get_contents('php://stdin'),FILE_APPEND);"
this logs all emails sent via mail() to c:\mail.log
On Jun 17, 10:22 pm, gosha bine <stereof...@gmail.comwrote:
William Gill wrote:
My development machine (WinXP, Apache 2.2.4) does not have an smtp
server, and I don't really want to install one if I can help it.
Does anyone know of a simple method of testing php scripts that employ
mail() by simulating an smtp server and directing output to a text file
or to an installed text editor.
I have the following in my php.ini
sendmail_path = php -r
"file_put_contents('c:/mail.log',file_get_contents('php://stdin'),FILE_APPEND);"
this logs all emails sent via mail() to c:\mail.log
--
gosha bine
extended php parser ~http://code.google.com/p/pihipi
blok ~http://www.tagarga.com/blok
thanks for that idea, very nice. (verified on xp)
gosha bine wrote:
William Gill wrote:
>Looks good, but it causes a parsing error on WinXP. I may use it on my Linux boxes though.
Works just fine for me. Make sure you've copied it properly.
Finally! I had to put the entire path specification to php.exe, even
though it was clearly in %PATH%. Anyway works great and is just what I
needed.
Also, please do not top-post. Post your replies below the quoted text.
>> Bill
gosha bine wrote:
>>William Gill wrote: My development machine (WinXP, Apache 2.2.4) does not have an smtp server, and I don't really want to install one if I can help it.
Does anyone know of a simple method of testing php scripts that employ mail() by simulating an smtp server and directing output to a text file or to an installed text editor.
I have the following in my php.ini
sendmail_path = php -r "file_put_contents('c:/mail.log',file_get_contents('php://stdin'),FILE_APPEND);"
this logs all emails sent via mail() to c:\mail.log
Thanks,
Bill
On 18.06.2007 01:51 William Gill wrote:
>
gosha bine wrote:
>William Gill wrote:
>>Looks good, but it causes a parsing error on WinXP. I may use it on my Linux boxes though.
Works just fine for me. Make sure you've copied it properly.
Fixing the cut and paste error, and commenting out the "SMTP =" and
'smtp_port =' entries fixed the parse error. Now Xp is complaining
about php not being a recognized command when it's called from inside
Apache.
Add php directory to your path (My
Computer/Properties/Advanced/Environment, edit PATH then restart Apache)
or provide the full path to php executable (e.g. c:\path\to\php\php.exe)
--
gosha bine
extended php parser ~ http://code.google.com/p/pihipi
blok ~ http://www.tagarga.com/blok
William Gill wrote:
>
gosha bine wrote:
>William Gill wrote:
>>Looks good, but it causes a parsing error on WinXP. I may use it on my Linux boxes though.
Works just fine for me. Make sure you've copied it properly.
Finally! I had to put the entire path specification to php.exe, even
though it was clearly in %PATH%. Anyway works great and is just what I
needed.
Glad to hear it was helpful, Bill.
--
gosha bine
extended php parser ~ http://code.google.com/p/pihipi
blok ~ http://www.tagarga.com/blok
On Jun 17, 5:22 pm, gosha bine <stereof...@gmail.comwrote:
William Gill wrote:
My development machine (WinXP, Apache 2.2.4) does not have an smtp
server, and I don't really want to install one if I can help it.
Does anyone know of a simple method of testing php scripts that employ
mail() by simulating an smtp server and directing output to a text file
or to an installed text editor.
I have the following in my php.ini
sendmail_path = php -r
"file_put_contents('c:/mail.log',file_get_contents('php://stdin'),FILE_APPEND);"
this logs all emails sent via mail() to c:\mail.log
--
gosha bine
extended php parser ~http://code.google.com/p/pihipi
blok ~http://www.tagarga.com/blok
I would like to try this with my linux box. Do I put that line below
my sendmail_path line? 'php://...' has to be replaced with what for
linux?
Anything else I need to change? for example, I'm not sure if I should
put my global smtp server(google) where it says SMTP = localhost and
remove localhost, because it says just above it 'For Win32 only'.
I think I'm getting confused over reply.. basically, what is the step
by step procedure for this alternative you mention(other smtp, instead
of setting one up) in a Linux box?
Thanks,
-Patrick
On Jun 19, 1:56 am, Patrick <CaptainMorganRa...@gmail.comwrote:
On Jun 17, 5:22 pm, gosha bine <stereof...@gmail.comwrote:
William Gill wrote:
My development machine (WinXP, Apache 2.2.4) does not have an smtp
server, and I don't really want to install one if I can help it.
Does anyone know of a simple method of testing php scripts that employ
mail() by simulating an smtp server and directing output to a text file
or to an installed text editor.
I have the following in my php.ini
sendmail_path = php -r
"file_put_contents('c:/mail.log',file_get_contents('php://stdin'),FILE_APPEND);"
this logs all emails sent via mail() to c:\mail.log
--
gosha bine
extended php parser ~http://code.google.com/p/pihipi
blok ~http://www.tagarga.com/blok
I would like to try this with my linux box. Do I put that line below
my sendmail_path line? 'php://...' has to be replaced with what for
linux?
Anything else I need to change? for example, I'm not sure if I should
put my global smtp server(google) where it says SMTP = localhost and
remove localhost, because it says just above it 'For Win32 only'.
I think I'm getting confused over reply.. basically, what is the step
by step procedure for this alternative you mention(other smtp, instead
of setting one up) in a Linux box?
Thanks,
-Patrick
you can either configure your sendmail to connect to google (probably
via stunnel or putty) and pass the email on that way, or you could
write a small script that took the php://stdin and uses phpmailer to
connect to google for you (again probably through something that can
handle SSL) you get the added bonus of having being able to dump the
mail locally before it is sent by phpmailer.
both of these options use the method above with a tweak to either your
sendmail executable, or the script that handles the mail.
OK forgive my ignorance, but this has been bugging me since you posted
the solution. Could you explain the notation "php://stdin". I thought
stdin was stdin, is there a way to differentiate?
Again, forgive my ignorance.
Bill
gosha bine wrote:
William Gill wrote:
>My development machine (WinXP, Apache 2.2.4) does not have an smtp server, and I don't really want to install one if I can help it.
Does anyone know of a simple method of testing php scripts that employ mail() by simulating an smtp server and directing output to a text file or to an installed text editor.
I have the following in my php.ini
sendmail_path = php -r
"file_put_contents('c:/mail.log',file_get_contents('php://stdin'),FILE_APPEND);"
this logs all emails sent via mail() to c:\mail.log
William Gill wrote:
OK forgive my ignorance, but this has been bugging me since you posted
the solution. Could you explain the notation "php://stdin". I thought
stdin was stdin, is there a way to differentiate?
Again, forgive my ignorance.
Bill
Never mind, I finally found the manual reference for input/output streams.
gosha bine wrote:
>William Gill wrote:
>>My development machine (WinXP, Apache 2.2.4) does not have an smtp server, and I don't really want to install one if I can help it.
Does anyone know of a simple method of testing php scripts that employ mail() by simulating an smtp server and directing output to a text file or to an installed text editor.
I have the following in my php.ini
sendmail_path = php -r "file_put_contents('c:/mail.log',file_get_contents('php://stdin'),FILE_APPEND);"
this logs all emails sent via mail() to c:\mail.log
Thanks,
bill This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Karuna |
last post by:
Hi everybody,
I have been trying to write a simple mail script using PHP and apache
on Windows XP. Eventhough the script is saying that the mail is
successfully sent, I am unable get it in my...
|
by: \Crash\ Dummy |
last post by:
I would like to use a form on my web site to e-mail user comments to me. I have
ASP capability to run server side scripts. The host domain has a SMTP server,
but I don't know if it is on the same...
|
by: Gerhard |
last post by:
Hi,
I some asp.net beta 2 code that works fine on an XP Pro machine, but on a
Windows 2003 Server gets the following error:
System.Net.Mail.SmtpFailedRecipientException {"Mailbox unavailable....
|
by: Robert V. Hanson |
last post by:
Please give me some ideas on how to setup the ability to test
System.Web.Mail code to send emails using just my development computer,
Win2000Pro OS and IIS5.0?
Thanks,
Bob Hanson
|
by: Pascal Cloup |
last post by:
Hello,
I just want to send an e-mail from my windows form application without
specifying SmtpServer.
On my computer, when i specify my smtpserver, SmtpMail.Send( aMail ) works
fine, but...
|
by: Tiabes |
last post by:
Hi,
I am using System.Web.Mail for a email feature in an Intranet Application
(ASP.NET). I need to use NTLM Authentication:
...
|
by: Ing. Davide Piras |
last post by:
Hi there,
I use Visual Studio 2005, c# projects...
I like the new unit test framework very much, it helps a lot mantaining and
growing up a project with the test driven paradigm, that's so good!...
|
by: Homer |
last post by:
Hi,
I've posted this question before but didn't get anywhere with it.
Please help me out if you know of a solution for it.
I got "InnerException: Unable to connect to remote server"..."No...
|
by: =?Utf-8?B?UmljaA==?= |
last post by:
I want to build an simple email smtp client app similar to outlook except
with some custom features for a personal computer that uses comcast cable.
The owner of the computer said she doesn't have...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
| |