PHP SMTP Mailers
am 20.03.2010 12:14:12 von King Coffee
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
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Re: PHP SMTP Mailers
am 20.03.2010 13:31:07 von ro0ot.w00t
--0015174bf17a62a7c904823aa329
Content-Type: text/plain; charset=ISO-8859-1
2010/3/20 King Coffee
> 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
--0015174bf17a62a7c904823aa329--
Re: PHP SMTP Mailers
am 21.03.2010 15:04:58 von King Coffee
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:
require_once "Mail.php";
// SSL HOST
$host = "ssl://smtp.gmail.com";
$port = "587";
$username = "Sender@gmail.com";
$password = "Password";
$from = "King Coffee ";
$to = "Bill ";
$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( "" . $mail->getMessage() . "
");
} else {
echo("Message successfully sent
");
}
?>
PHP EMAIL TESTER
This is a test
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
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Re: PHP SMTP Mailers
am 22.03.2010 13:27:53 von Auke van Slooten
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).
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Re: PHP SMTP Mailers
am 22.03.2010 14:43:02 von Michael Peters
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:
require("class.phpmailer.php");
class MyMailer extends PHPMailer {
// Set default variables for all new objects
var $From = "zonata@shastaherps.org";
var $FromName = "Lampro P. Eltis";
var $ReplyTo = "mpeters@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.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Re: PHP SMTP Mailers
am 22.03.2010 22:25:36 von King Coffee
Thanks,
I try it and had not problems!
King
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php