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.

Send Email from localhost/WAMP Server using PHPMailer/SMTP | TechWheels.net's Technology Blog When building professional web applications, it is very necessary to test email functionality before deploying the website. It is therefore a requirement for web developers to send emails from their development machine during development process. This solution is useful not only for localhost/WAMP server but also for sending bulk emails from online website. Solution After tweaking with the Apache and PHP’s INIs, I succeeded in sending email from my WAMP server. So, to use PHPMailer with Gmail, ensure the following: IMAP Access is enabled in your Gmail’s Settings -> Forwarding and POP/IMAP -> IMAP Access: “ssl_module” module in Apache server is enabled: “php_openssl”, “php_smtp” and “php_sockets” extensions for PHP compiler are enabled: From PHPMailer’s .zip file, extract “class.phpmailer.php” and “class.smtp.php” files to “C:\wamp\www\” folder. $mail->Port$mail->Host$mail->Mailer$mail->SMTPSecure$mail->Username$mail->Password$mail->From$mail->FromName Update (2-Dec-2012) Rate this article

Beginner to Intermediate PHP Exercises Online membership management software We will learn here how to store encrypted password in the table. Before this in our basic Member signup & login script we have used varchar field to store the passwords of the users. For better security of our software we will encrypted the password by using MD5 encryption and then store the hash of the password string in the table. With the popularity of Ajax , we have included this concept in our membership management script new versions. Length of the password field to store MD5 encrypted password In the present membership management software we have increase the filed size to 32. Signup page While inserting the member details to our member table we have to encrypt the password of the member before storing them in the table. $password=md5($password); // Encrypt the password before storing $query=mysql_query("insert into plus_signup(userid,password,email,name,sex) values('$userid','$password','$email','$name','$sex')"); Login page Change password page Forgot password feature.

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.

Related: