News Feed
Sections




News Archive
feed this:

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

SitePoint PHP Blog:
Piping Emails to a Laravel Application
February 17, 2014 @ 09:13:48

On the SitePoint PHP blog there's a new tutorial posted about piping emails to Laravel (well, a Laravel-based application). He shows how to have your application take data in from the current input, parse it and insert the data into a database.

In project management or support management tools, you will see this a lot: you can reply to an email message and it is automatically visible in a web application. Somehow, these tools were able to get those email messages right into their system. In this article, we are going to have a look at how we can pipe emails to our Laravel 4 application.

He walks you through the creation of an Artisan command, "email.parse", and using the PHP MIME Mail Parser library to extract data. He gets the to, from, title and message contents from the email and shows how to work with attachments too. Finally, he shows how to set up the mail server to pipe the incoming email though the PHP script for parsing.

0 comments voice your opinion now!
email parse message laravel tutorial mail server

Link: http://www.sitepoint.com/piping-emails-laravel-application/

Rob Allen:
Sending an HTML with text alternative email with ZendMail
November 02, 2012 @ 10:26:20

Rob Allen has a quick tutorial posted to his site today showing you how to send an email with the ZendMail component of the Zend Framework 2 that contains HTML but provides a plain text backup in the same message.

Sending a multi-part email with ZendMail is easy enough, but if you want to send an HTML email with a text alternative, you need to remember to set the content-type in the headers to multipart/alternative. As this is the second time I had to work this out, I'm noting it here for the next time I forget!

The rest of the post is the code you'll need to send a simple email with a text and HTML body sections, configure the headers (to, from, etc) and the "multipart/alternative" header to make the HTML or plain text switching work correctly.

0 comments voice your opinion now!
zendframework2 mail tutorial send alternative html plaintext


Arvind Bhardwaj's Blog:
How to Test PHP Emails on Localhost
June 09, 2012 @ 12:02:20

In this quick tutorial Arvind Bhardwaj shows a method for testing your scripts that need to send emails, but on your localhost system.

While developing web applications on localhost you must have always missed the functionality to send mails. As localhost does not support email service, so it has always been a bottleneck for email testing on localhost. But I have found a simple way to test emails on localhost using PHP. I have overridden the default mail() function of PHP to create a text/html file based on the email format. If the email is in html format, an HTML file is created otherwise a text file is created. You can see in this file what exactly is the content sent in your mail. See how does it work.

He shows how to override the mail function with your own custom "mail" function, just in a difference namespace. He includes the sample code to send the email (the "mail" function), a basic HTML template you can use and and example of it in use.

0 comments voice your opinion now!
mail localhost email tutorial testing


DreamInCode.com:
Preventing PHP Mail(...) Header Injections
April 22, 2011 @ 11:06:23

On the Dream In Code forums there's a recent post showing you how to prevent mail() header injections when taking user input, like from a form.

PHP's mail() function is a very useful and powerful function, even to the point that it is very easy to exploit. A way hackers exploit this function is a method called email header injection. [...] I'm sure most of you can already tell that's not going to be pretty since we didn't check the user input and so forth. PHP provides us with functions such as filter_var which will validate user input and either return false if the validation fails or return the filtered data.

He includes an example of using this filtering methods to check the user input for malicious information - validating that the "to" address is a valid email (FILTER_VALIDATE_EMAIL) and a sanitize() method that removes things like newlines, carriage returns and a few other characters.

1 comment voice your opinion now!
prevent mail header injection tutorial filtervar sanitize


NetTuts.com:
How to Send Text Messages with PHP
January 25, 2011 @ 10:14:39

On NetTuts.com today there's a new tutorial showing you how to send text messages via SMS directly from your script to the user's cell phone.

Text messaging has become extremely widespread throughout the world - to the point where an increasing number of web applications have integrated SMS to notify users of events, sales or coupons directly through their mobile devices. In this tutorial, we will cover the fundamentals of sending text messages with PHP.

Their method "cheats" a little bit and uses an interface many of the cell phone providers offer to their subscribers - a link from an email address to SMS. Most providers have their domains you can send the email to and have it automatically forwarded to the user's cell as a text. Thankfully, this requires nothing more than the mail function to accomplish. They include the sample code and HTML+CSS to make a basic form as well as mention PHPMailer as a more powerful mailing alternative.

1 comment voice your opinion now!
text message tutorial send phpmailer mail


PHPBuilder.com:
Downloading and Parsing Gmail Messages in PHP
September 01, 2010 @ 09:21:04

New on PHPBuilder.com today there's a tutorial showing you how to download and parse messages from Google Mail. In their case it's grabbing and parsing submissions from a form.

Some friends of mine publish a literary journal that accepts submissions via email. At their request I wrote a script to download messages from the journal's Gmail account and do some simple parsing tasks. Most of the submissions are made using an HTML form and a corresponding mailer script on their website, so I knew the precise format of the incoming messages (see Figure 1). What I didn't know was how to access Gmail in PHP.

He tried out the libgmailer script first, but ran into roadblocks until he realized he could use something PHP already had - the imap functions. With these he shows how to make a connection to the Gmail servers, get the listing of messages and pull out the body for the one you want to parse.

1 comment voice your opinion now!
gmail google mail parse imap tutorial


Daniel Cousineau's Blog:
Setting Up Mail() on Windows, or Where is my Windows Sendmail.exe?
August 21, 2009 @ 13:14:14

In his development on a Windows environment, Daniel Cousineau has come across a hurdle - sending emails from his local machine from his PHP scripts. Thankfully he's found a solution and has shared it in a new blog post.

Previously it was a simple trek to a website to download a Windows build of sendmail.exe, but for some reason I cannot get access to it, so I have to go another route. Enter hMailServer, a free, full-featured SMTP/POP/IMAP server for Windows with a pretty, shiny GUI configuration interface. All I really want to do is setup SMTP for localhost only but one could easily use hMailServer as a production mail server.

He includes the details (along with some screenshots) to get the hMainServer software up and running. Thanks to the simple GUI the tool offers you can be up and working in a few clicks - oh, and a change to your php.ini file.

0 comments voice your opinion now!
sendmail windows hmailserver development mail


PHPClasses.org Blog:
Sending e-mail using [Remote] SMTP servers/MIME Email
April 20, 2009 @ 11: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.

0 comments voice your opinion now!
server remote yahoo google smtp mail send package


NETTUTS.com:
9 Extremely Useful and Free PHP Libraries
April 09, 2009 @ 07:51:16

NETTUTS.com has posted a list of nine libraries you can use to quickly and easily add functionality to your web application.

A lot of functionality is shared among applications - like sending emails or preventing spam. In the spirit of reusing the wheel instead of reinventing it, here are nine free web libraries that you can use in your next program which will dramatically increase your efficiency.

Here's their list:

Screenshots (and code examples) are provided for several of the items as well as links to their website and documentation pages.

5 comments voice your opinion now!
useful library list captcha aksimet json chart xmlrpc amazon s3 mail


Ilia Alshanetsky's Blog:
Mail Logging for PHP 5.3+
January 12, 2009 @ 12:53:12

Ilia Alshanetsky has officially submitted his logging patch for the mail function in PHP:

I've finally got of my ass and committed my mail logging patch I've written almost 2 years ago. This functionality is predominantly aimed at shared hosters that often have a problem identifying people who abuse the mail() function to send an in-ordinate amount of spam or hacked scripts used for the some purpose. The logging functionality is disabled by default but can be enabled on a per-directory or globally via 2 INI settings.

A new directive in your php.ini file (mail.log) lets you specify where the mail log needs to go. You can also use the mail.add_x_header setting to add in a mail header with the name of the script that sent it (and the UID).

It will be included in PHP 5.3 but if you're running PHP 5.2 and want to get a jump on it, here's the patch.

28 comments voice your opinion now!
mail logging patch php5 phpini log header originating script



Community Events





Don't see your event here?
Let us know!


language release community symfony introduction unittest configure laravel install wordpress code api podcast library bugfix list interview developer series application

All content copyright, 2014 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework