background preloader

PHPMailer tutorial for (SMTP and GMail)

PHPMailer tutorial for (SMTP and GMail)
These days I tried some plugin to send e-mail message within WordPress via SMTP. Since my domains email is hosted with Google applications I decided to send my messages via the SMTP server from GMail. I found several articles and PHPMailer tutorials, but a lot of them didn’t worked for me. Why using GMail for sending mail messages? First of all it’s FREE! Sure most website owners can use their own SMTP server for sending email messages from their website, but it makes sense even than to use GMail for sending mail. Requirements You need for this PHPMailer code example a PHP5 enabled web host (I did tests only on Linux), the port 465 need to be open and of course you need a GMail or Google Apps account. Trouble sending e-mails with your “normal” GMail account? PHPMailer tutorial for GMail and Google Apps Hosting for developers - Free Trial! Advanced setup with fall-back SMTP server Next we need to create an if/else statement using the variables for the second server (replace). with this code

[Solved]PHP mail function not sending Occasionally I have had trouble sending emails using the builtin mail() function in PHP. Sometimes emails never reached their intended destination. Naturally I have assumed that there might be a problem with some spam filters used. However, lazy as I am, I have not given it a second thought. Instead I have used a PHP class that allows me to send emails using a remote smtp server using an account on that dedicated server. The problem seems to be that PHP use the ini directive sendmail_from to set the from email address in the SMTP protocol. The simplest solution is to set the directive during execution: ini_set("sendmail_from", $email_from); $headers = "From: $email_from";mail($to, $subject, $message, $headers); The problem as well as the solution was already known by others. Still I bet there are lots of people out there with this problem without them knowing it.

Beginner to Intermediate PHP Exercises When and why to use 301 or 302 redirects | The Search Engine Optimization Blog I’m often asked about the differences between the 301 and 302 redirect and how they affect the way search engines see a site. Another popular question is why it even matters which one is used, since from a user’s perspective everything looks fine with both types of redirects Well, even though things might look fine on the users end, these redirects can cause a great deal of trouble if not employed correctly. These two redirects have two different uses and should be applied accordingly. Just remember a 301 redirect is a “Permanent Redirect” which transfers over the page rank and other historical search engine data. The 302 redirect is a “Temporary Redirect” which does not transfer over this information and should only be used in very limited situations. Some examples of when you would use a 301 redirect are: 1. 2. 301 redirects can be used to point (non-www) links to (www-version) instead.