Sunday, 15 September 2013

Emai verification system testing PHP, CodeIgniter

Emai verification system testing PHP, CodeIgniter

I am currently building an online registry system and one of its modules
is the registration system.
After a user successfully register, a verification email is sent to
his/her email address. I followed every tutorial I read online and I'm
still getting the same problem.
here's what i got so far:
//this is what it looks like in my controller after validation of fields
from registration
$this->load->library('email');
$this->email->set_newline("\r\n");
$this->email->from('my_personal_email@gmail.com', 'Mike Lee');
$this->email->to($email);
$this->email->subject('Email Test');
$this->email->message('Testing the email class.');
if($this->email->send()){
//this is to check if email is sent
redirect('site/registered');
}else{
//else error
show_error($this->email->print_debugger());
}
for my configuration of email.php:
class CI_Email {
var $useragent = "CodeIgniter";
var $mailpath = "/usr/sbin/sendmail"; // Sendmail path
var $protocol = "smtp"; // mail/sendmail/smtp
var $smtp_host = "https://smtp.googlemail.com"; // SMTP
Server. Example: mail.earthlink.net
var $smtp_user = "my_personal_email@gmail.com"; // SMTP Username
var $smtp_pass = "my_personal_emailpassword"; // SMTP Password
var $smtp_port = "25"; // SMTP Port
var $smtp_timeout = 10; // SMTP Timeout in seconds
var $smtp_crypto = ""; // SMTP Encryption. Can be null, tls or ssl.
var $wordwrap = TRUE; // TRUE/FALSE Turns word-wrap on/off
var $wrapchars = "76"; // Number of characters to wrap at.
var $mailtype = "text"; // text/html Defines email formatting
var $charset = "utf-8"; // Default char set: iso-8859-1 or us-ascii
var $multipart = "mixed"; // "mixed" (in the body) or "related"
(separate)
var $alt_message = ''; // Alternative message for HTML emails
var $validate = FALSE; // TRUE/FALSE. Enables email validation
var $priority = "3"; // Default priority (1 - 5)
var $newline = "\n"; // Default newline. "\r\n" or "\n" (Use
"\r\n" to comply with RFC 822)
var $crlf = "\n"; // The RFC 2045 compliant CRLF for
quoted-printable is "\r\n". Apparently some servers,
// even on the receiving end think they
need to muck with CRLFs, so using "\n",
while
// distasteful, is the only thing that
seems to work for all environments.
var $send_multipart = TRUE; // TRUE/FALSE - Yahoo does not like
multipart alternative, so this is an override. Set to FALSE for Yahoo.
var $bcc_batch_mode = FALSE; // TRUE/FALSE Turns on/off Bcc batch feature
var $bcc_batch_size = 200; // If bcc_batch_mode = TRUE, sets max
number of Bccs in each batch
var $_safe_mode = FALSE;
var $_subject = "";
var $_body = "";
var $_finalbody = "";
var $_alt_boundary = "";
var $_atc_boundary = "";
var $_header_str = "";
var $_smtp_connect = "";
var $_encoding = "8bit";
var $_IP = FALSE;
var $_smtp_auth = FALSE;
var $_replyto_flag = FALSE;
var $_debug_msg = array();
var $_recipients = array();
var $_cc_array = array();
var $_bcc_array = array();
var $_headers = array();
var $_attach_name = array();
var $_attach_type = array();
var $_attach_disp = array();
var $_protocols = array('mail', 'sendmail', 'smtp');
var $_base_charsets = array('us-ascii', 'iso-2022-'); // 7-bit charsets
(excluding language suffix)
var $_bit_depths = array('7bit', '8bit');
var $_priorities = array('1 (Highest)', '2 (High)', '3 (Normal)', '4
(Low)', '5 (Lowest)');
here's the error:
/* A PHP Error was encountered
Severity: Warning
Message: fsockopen() [function.fsockopen]: unable to connect to
ssl://smtp.googlemail.com:25 (A connection attempt failed because the
connected party did not properly respond after a period of time, or
established connection failed because connected host has failed to
respond. )
Filename: libraries/Email.php
Line Number: 1689 */
i use my personal email acct to send test mail. but i don't know if that
will work with gmail. can you somehow enlighten me how i can test if my
code is working? or is there a software that can be used as my test server
to send mail?
thanks. :(

No comments:

Post a Comment