Categories
PHP

Laravel 4: Sending Emails

Laravel 4 uses SwiftMailer library behind the stage. They have wrapped the SwiftMailer functionality in elegant and easy to use APIs for delivering emails.

The Mail::send() API is straight forward, it takes these as argument –

# The email template to render. You can pass an array for sending both text and html emails.
# The data array which contains the values for the email template.
# A closure to configure the message. The closure is passed an instance of SwiftMailer and you can use the same set of configuration you can use with SwiftMailer.

Choosing a Mail Transport

Laravel 4 allows easy configuration of the mail transport in app/config/mail.php file. The framework has drivers for smtp, PHP’s mail() function and sendmail. If you have a local smtp server running, choose the smtp driver. Set the host to localhost and port to 25.

Pretend Sending Mail

Laravel4 has a nice feature for testing emails on local machines where you probably don’t have a mail server installed and/or configured. You can switch “pretend” in the above configuration to true or use Mail::pretend(TRUE) before making a call to Mail::send(). This will not try to deliver the mail but make a log in the application log file. You can find the logs files in – “app/storage/logs” directory.

Categories
Javascript

Log to Firebug Console from Firefox Extensions

This is a quick and short post, mainly for self documentation. If you are working on a Firefox extension and want to do “console.log()” to Firebug, you need to use this instead –

You can’t directly use console.log() because your code doesn’t execute from within a “window” instance. If you get “Firebug” is undefined or some similar error messages, make sure that Firebug is installed and working properly.

Firebug needs to be running when you try to log the strings.

Categories
Uncategorized

Beautiful Themes for Sublime Text 3

I have been using ST3 for a while now on test drive and I have checked out some of the themes currently available for Sublime Text 3. All of these themes are available via Package Control. I am also going to link the screenshots to their respective github repo in case you don’t want to use Package Control for some (weird) reasons.

Soda Theme

Soda is probably the most popular theme for Sublime Text

Flatland Theme

Cobalt 2

Nexus Theme

Reminds me of Google Nexus.

Nexus Theme

Pseudo OSX theme

Mac / OS X users are going to love this one

Reeder Theme

Here’s another nice one

Phoenix Theme

And it’s cool

Centurion

Which one did I miss?

So you know there’s a cool theme for ST3 that is not yet on this list? Please let me know in the comments, I shall add it.