Prev: Fwd: Re: [PHP] any reason *not* to use PEAR DB module whenaccessing mysql?
Next: How do I upgrade GD?
From: "King Coffee" on 20 Mar 2010 07:14 Hi, I'm executing a third-parity standard PHP application on a Windows IIS 7 shared hosting server. I need to convert, or use, a SMTP mailer service. I found two SMTP PHP scripts - I think may work. The sourceforge.net PHPMailer project and the pear.php.net (Mail, Net_SMTP) project. Can any body please help me choose one and probably give a code snip of useage? Currently, I'm leaning forward the PHPMailer, with little to base the decision on. Thanks in advanced, King Coffee
From: "Jan G.B." on 20 Mar 2010 08:31 2010/3/20 King Coffee <kcoffee(a)hotmail.com> > Hi, > > I'm executing a third-parity standard PHP application on a Windows IIS 7 > shared hosting server. > > I need to convert, or use, a SMTP mailer service. I found two SMTP PHP > scripts - I think may work. > > The sourceforge.net PHPMailer project and the pear.php.net (Mail, > Net_SMTP) project. > > Can any body please help me choose one and probably give a code snip of > useage? > > Currently, I'm leaning forward the PHPMailer, with little to base the > decision on. > > Thanks in advanced, > King Coffee Hi. I'd stick to a PEAR module as long as it exists, because you can update it easily. Check out the examples in the PEAR Documentation. http://pear.php.net/manual/en/package.mail.mail.intro.php There's also a full detail example here: http://pear.php.net/manual/en/package.mail.mail.send.php Bye
From: "King Coffee" on 21 Mar 2010 10:04 Thanks Jan G. B., You got me over the first hump. I'm having programs installing pear on my VISTA localhost... So, I uploaded the Mail folder and Mail.php file to my Shared Hosting ISP. I do not think pear is provided. The Testing is as follows: <?php require_once "Mail.php"; // SSL HOST $host = "ssl://smtp.gmail.com"; $port = "587"; $username = "Sender(a)gmail.com"; $password = "Password"; $from = "King Coffee <Sender(a)gmail.com>"; $to = "Bill <Recipient(a)hotmail.com>"; $subject = "PHP Mail Test"; $body = "This is a simple mail test!"; $headers = array('From' => $from, 'To' => $to, 'Subject' => $subject); $smtp = Mail::factory('smtp', array('host' => $host, 'port' => $port, 'auth' => true, 'username' => $username, 'password' => $password)); $mail = $smtp->send($to, $header, $body); if(PEAR::isError($mail)) { echo( "<p>" . $mail->getMessage() . "</p>"); } else { echo("<p>Message successfully sent</p>"); } ?> <html> <head> <title>PHP EMAIL TESTER</title> <h1>This is a test</h1> <?php Echo "Hi King"; ?> </head> </html> When I run the server page, The following error is displayed: Warning: require_once(PEAR.php) [function.require-once]: failed to open stream: No such file or directory in D:\Hosting\ID#\html\auction\Mail.php on line 46 Fatal error: require_once() [function.require]: Failed opening required 'PEAR.php' (include_path='.;C:\php5\pear') in D:\Hosting\ID#\html\auction\Mail.php on line 46 I will be still trying the get pear installed in VISA, but meanwhile, how can I obtain the PEAR.php and supporting files to upload? Thanks, King
From: Auke van Slooten on 22 Mar 2010 08:27 King Coffee wrote: > Hi, > > I'm executing a third-parity standard PHP application on a Windows IIS 7 > shared hosting server. > > I need to convert, or use, a SMTP mailer service. I found two SMTP PHP > scripts - I think may work. > > The sourceforge.net PHPMailer project and the pear.php.net (Mail, > Net_SMTP) project. > > Can any body please help me choose one and probably give a code snip of > useage? > > Currently, I'm leaning forward the PHPMailer, with little to base the > decision on. Hi, I'd take a look at http://www.phpguru.org/static/smtp.html It doesn't make the mistake of muddling the differnece between the message envelope and the message body, so you can set the recipients directly and different from the messages to/cc/bcc headers. It has a fairly sane design, based on the smtp protocol. And finally it uses exceptions in a sane way. Oh, and its a fairly small and straightforward piece of code, easy to include in any application. There's one problem in it when using it for bulk-mail. If you add many recipients and one of them is incorrect, it will fail the entire message. It's not free for commercial use, but the one-time license fee is more than worth it. regards, Auke van Slooten Muze (And no, I'm not affiliated with the author, just a happy customer).
From: "Michael A. Peters" on 22 Mar 2010 09:43 King Coffee wrote: > Hi, > > I'm executing a third-parity standard PHP application on a Windows IIS 7 > shared hosting server. > > I need to convert, or use, a SMTP mailer service. I found two SMTP PHP > scripts - I think may work. > > The sourceforge.net PHPMailer project and the pear.php.net (Mail, > Net_SMTP) project. > > Can any body please help me choose one and probably give a code snip of > useage? > > Currently, I'm leaning forward the PHPMailer, with little to base the > decision on. > > Thanks in advanced, > King Coffee > I use phpmailer and find it to be painless and consistent. I extend the class and call the extended class: <?php require("class.phpmailer.php"); class MyMailer extends PHPMailer { // Set default variables for all new objects var $From = "zonata(a)shastaherps.org"; var $FromName = "Lampro P. Eltis"; var $ReplyTo = "mpeters(a)mac.com"; var $Host = "localhost"; var $Mailer = "smtp"; // Alternative to IsSMTP() var $WordWrap = 75; } ?> Then when I want to use it - $mail = new MyMailer(); $mail->Subject = "Some Subject"; $mail->Body = "Some content"; if($mail->Send()) { // it was successfully sent, code on success here } else { // there was an error, error code here } I never send HTML mail or attachments or bulk mail, but I believe it is capable of doing them quite easily. Tip: Whatever solution you use, set the wordwrap to something that works well on an 80 char display. Some clients do not autowrap unwrapped messages and other clients wrap for display but when replying, it doesn't wrap. I use 75 because it gives a little room for the "> " that accompanies a reply.
|
Next
|
Last
Pages: 1 2 Prev: Fwd: Re: [PHP] any reason *not* to use PEAR DB module whenaccessing mysql? Next: How do I upgrade GD? |