Re: Publishing in PECL php extension smtpmail

From: Date: Sat, 27 Oct 2012 11:04:46 +0000
Subject: Re: Publishing in PECL php extension smtpmail
References: 1  Groups: php.pecl.dev 
Request: Send a blank email to pecl-dev+get-9931@lists.php.net to get a copy of this message
Corrected fail example from the previous mail $smtpmail0 = smtpmail_connect("smtp0",42,"test","test","utf-8","\n"); $smtpmail1 = smtpmail_connect("smtp1",25,"test","test","utf-8","\n"); the second call would invalidate the data from $smtpmail0. On Sat, October 27, 2012 13:01, Anatoliy Belsky wrote: > Hi, > > i think it were much better to work with a resource instead of writing all > the connection data into globals. Currently the code like this will work > not as expected > > $smtpmail = > smtpmail_connect("smtp0",42,"test","test","utf-8","\n"); > $smtpmail = > smtpmail_connect("smtp1",25,"test","test","utf-8","\n"); > > because the second call would overwrite the data of the first one. Making > smtpmail_connect() returning resource would require no changes to the > userspace syntax and fix this. > > Also currently you don't free what you estrdup for the globals. > > Other small things - pecl coding style > http://lxr.php.net/xref/PHP_5_4/CODING_STANDARDS . C++ > comments, > identiation. I'd additionally translate the comments in the code to > English. > > Besides that generally looks ok to me from the technical side. > > Btw. why can't you use mail() in China? Always worked for me when > installing some lightweight MTA on the host where php runs, like > https://wiki.archlinux.org/index.php/NBSMTP (but there are > actually many > others), so it should work anywhere :) > > Regards > > Anatoliy > > On Sat, 27 Oct 2012 15:47:40 +0800 > 李明贵 <keminar@gmail.com> wrote: > >> I am a php developer in china. I have worked six years on it .I love php > and love opensource. I want to share something with others. >> smtpmail is a php extension, it use esmtp protocol to send email . I > develop it because of usually php's function mail can't use in china.Use > php to write a fsockopen client will cost more time and is hard to a > newer >> learn php. Last , as you know php extension will run faster. >> A simple example >> <?php >> $smtpmail = > > smtpmail_connect("smtp.qq.com",25,"test","test","utf-8","\n"); >> smtpmail_from($smtpmail,"from@qq.com","SMTPMAIL"); >> $result = > > smtpmail_send($smtpmail,'title','content',"to@qq.com","keminar"); >> if%2

« previous php.pecl.dev (#9931) next »