Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

SitePoint PHP Blog:
Sending Emails in PHP with PHPMailer
Apr 27, 2015 @ 17:53:56

The SitePoint PHP blog has a tutorial from Narayan Prusty showing you how to effectively use PHPMailer to send emails from your PHP application. PHPMailer provides a simplified interface to send both simple and complex emails.

PHPMailer is one of the most popular open source PHP libraries to send emails with. It was first released way back in 2001 and since then it has become a PHP developer’s favorite way of sending emails programmatically, aside from a few other fan favorites like Swiftmailer. In this article we’ll talk about why you should use PHPMailer instead of PHP’s mail() function and we’ll show some code samples on how to use this library.

He starts by answering the obvious question - is it an alternative to PHP's own mail function? He describes the differences, mostly in the way of enhanced functionality PHPMailer offers. He then helps you get it installed via Composer and how to send a first simple email. Next up he shows how to send an email with attachments and connecting the library to an external SMTP server for sending. The tutorial finishes with a quick mention of using POP3 to read emails and how to show local error messages when something goes wrong.

tagged: tutorial send email phpmailer library simple attachment smtp pop3 error

Link: http://www.sitepoint.com/sending-emails-php-phpmailer/

DZone.com:
How to send emails from PHP on Windows
May 10, 2011 @ 13:53:15

On the PHP on Windows site (a part of DZone.com) Svetoslav Marinov has a quick new post looking at how you can set up your Windows PHP installation to be able to send emails similar to its linux cousins.

You'll need a server that you can use SMTP on to send the emails to, but outside of that, the setup is pretty painless. He recommends using the sendmail for Windows tool to do the backend lifting. He includes the settings, both for sendmail and PHP, and configuration changes you'll need to get it all working too.

He points to the mail manual page to grab a simple result for testing the install.

tagged: windows sendmail tutorial email smtp

Link:

RooJs.com:
How to spam in PHP..
Apr 11, 2011 @ 15:20:41

On RooJs.com there's a recent post from Alan Knowles looking at how to spam in PHP. No, nothing malicious - it's more about scalability in sending emails from PHP applications.

The reason this has been relivant in the last two weeks is two fold, first off, my slow and sometimes painfull Pman.Core and Pman.Base). It seemed like an ideal time to write some generic code that can solve both issues.

He mentions the usual method of generating numerous emails and sending them to a remote SMTP server, but points out that there's a better way. You can take advantage of queuing and batch sending techniques and, the way he decided to do it for mtrack, using queue tables and a backend runner (a cron job) that uses proc_open to send out multiple emails at once. You can see the code for it here.

tagged: spam email send smtp process procopen mtrack

Link:

SeeIT Consult Blog:
PHP mail() with Ubuntu Desktop and Gmail
Aug 27, 2010 @ 13:57:20

In this new post to the SeeIT Consult blog they show you how to use the Google Mail STMP service to send emails directly from PHP - no local MTA required.

I use a local Apache/MySQL server on a laptop to do a lot of my development – I don’t need a full mail server just to send mail. Also SMTP servers on dynamically assigned IP addresses are so untrusted these days that you can be pretty much guaranteed that a decent spam filter will reject your email based on a RBL lookup. By using Google Mail’s authenticated SMTP service you bypass this restriction.

Their solution uses the ssmtp tool instead - a simpler MTA that doesn't require near the setup of others. They show you how to adjust the config to handle the PHP emails, set up some users and configure PHP (the sendmail_path in the php.ini) to push the emails through it. Because of the configuration changes, it then knows enough to push those emails out to Gmail's SMTP.

tagged: gmail smtp tutorial ssmtp mta email

Link:

Web Development Blog:
PHP Mail Scripts using SMTP transport, a guide for beginners
Apr 12, 2010 @ 15:47:47

From the Web Development Blog today there's a new tutorial showing you how to use STMP from PHP via one of three different tools - the Zend_Mail component of the Zend Framework, SwiftMailer and PHPMailer.

PHP has a very simple mail function which is used very often for basic text mail messages. What if you need to attach files or if you need to send your e-mail messages via SMTP? Than it’s time to use a more advanced script. This is because the standard mail function has only limited standard capabilities.

Snippets of code are included for each of the three showing how to send a simple email with the usual "To", "From" and body contents. All of the tools have the ability to include attachments, but that's not included here.

tagged: smtp tutorial beginner swiftmailer zendmail phpmailer

Link:

PHPClasses.org Blog:
Sending e-mail using [Remote] SMTP servers/MIME Email
Apr 20, 2009 @ 16:15:29

On the PHPClasses.org blog Manuel Lemos has a recent post looking at a method for sending emails using a remote SMTP server (like Google or Yahoo's) via this package.

In most hosting environments, the PHP mail() function is sufficient to send e-mail messages without problems. However, there are situations on which using the mail function is inconvenient and may prevent that your messages reach the destination. [...] Therefore, you may need to find an alternative way for sending your e-mail messages from PHP.

The package lets you define a username/password, server, whether to use a SSL connection or not, and if the connection needs to use the TLS protocol.

tagged: server remote yahoo google smtp mail send package

Link:

Eran Galperin's Blog:
Handling mail and mime in PHP using the Zend Framework
Jul 18, 2008 @ 13:47:27

On the Techfounder blog (from Eran Galperin) there's a quick tutorial about using the Zend_Mail component of the Zend Framework to send both normal, plain-text emails and ones with MIME attachments.

Using PHP's built in function (aptly named mail() ) is relatively straightforward - until you need slightly more advanced features, such as adding and encoding email headers or sending multiple mails efficiently. Fortunately, the Zend Framework comes with a very capable mail component called Zend_Mail.

He shows how to send a simple email, do something a bit more complex with a custom SMTP server, read messages from a remote POP3 email box and how to attach a binary file/message.

tagged: zendframework email zendmail mime attachment pop3 read smtp custom

Link:

Richard Heyes' Blog:
SMTP for PHP 5
Feb 08, 2008 @ 16:27:00

Since he didn't come across any issues or bug reports, Richard Heyes has officially released his SMTP class for PHP5 as "out of public beta" and ready for production use.

I've not added any new features to the class; I've simply updated it to be, well, better. Plus it uses PHP5's object model better. It's really just an update, ie if you're using the old version and it works, then you have no real reason to update it.

You can check out the source here and an example of it in action here.

tagged: smtp php5 class release beta production

Link:

Sebastian Nohn's Blog:
Using Net_DNSBL and Nagios to check if your SMTP server is listed in a RBL
Oct 05, 2007 @ 15:22:00

Sebastian Nohn has created a handy little script using PEAR packages to work with a Nagios installation to perform an automatic check - validating that your domain isn't listed with the given black lists.

RBLs are a great way to get rid of a lot of SPAM (if you choose the right ones). On the other hand you (and users of your mail server) get in big trouble if your SMTP server gets listed on a common RBL.

Checking this manually is a job that sucks a lot, checking this automatically is an easy job with Nagios, PHP, Net_DNSBL and Console_Getopt.

He includes the parts you'll need - grabbing the PEAR package, the PHP script to make the request and the changes you'll need to make to the configuration files to make it all work together.

tagged: netdnsbl nagios smtp blacklist check pear package netdnsbl nagios smtp blacklist check pear package

Link:

Sebastian Nohn's Blog:
Using Net_DNSBL and Nagios to check if your SMTP server is listed in a RBL
Oct 05, 2007 @ 15:22:00

Sebastian Nohn has created a handy little script using PEAR packages to work with a Nagios installation to perform an automatic check - validating that your domain isn't listed with the given black lists.

RBLs are a great way to get rid of a lot of SPAM (if you choose the right ones). On the other hand you (and users of your mail server) get in big trouble if your SMTP server gets listed on a common RBL.

Checking this manually is a job that sucks a lot, checking this automatically is an easy job with Nagios, PHP, Net_DNSBL and Console_Getopt.

He includes the parts you'll need - grabbing the PEAR package, the PHP script to make the request and the changes you'll need to make to the configuration files to make it all work together.

tagged: netdnsbl nagios smtp blacklist check pear package netdnsbl nagios smtp blacklist check pear package

Link:


Trending Topics: