Welcome Guest, Not a member yet? Register   Sign In
Email notification with CI and hotmail
#1

[eluser]muttalebm[/eluser]
Hi guys,
I am trying to create an email notification system with CI. The problem is the system on which I am working on has blocked gmail. So, i am unable to use the gmail SMTP. Now, I have to figure out a way to send emails with hotmail or any other SMTP services.
Here is my code which worked for gmail but now for hotmail
config/Email.php:
Code:
$config = array(
    'protocol' => 'smtp',
    'smtp_host' => 'ssl://smtp.live.com',
    'smtp_port' => 587,
    'smtp_user' => '[email protected]',
    'smtp_pass' => 'XXXXXX',
    'charset' => 'utf-8',
'newline' => "\r\n",
'crlf' => "\r\n",
'mailtype' => "html",


);

the actual function that calls the email.php and send the email:
Code:
function sends($from,$to,$send,$user){
   $link=base_url()."index.php/anonymouscoll/cmembersarea/".$user;
   $emailmessage="Hello $to,<br />You have a new Gift from $from.<br />Click on the link:<a href=$link>$link</a> to check your gift.<br /><br /><br />Best Regards<br />Online Communication.";
   $this->load->library('email');
   $this->email->from('[email protected]','Gift File');
   $this->email->to($send);
   $this->email->subject('You have a new Gift');
   $this->email->message($emailmessage);
  
   if($this->email->send()){
    echo "Email sent";
    
   }
   else{
    show_error($this->email->print_debugger());
   }

Each time i call the 'sends' function i get the below error:
Code:
Severity: Warning

Message: fsockopen() [function.fsockopen]: SSL operation failed with code 1. OpenSSL Error messages: error:140770FC:SSL routines:SSL23_GET_SERVER_HELLO:unknown protocol

Filename: libraries/Email.php

Line Number: 1673
and
Code:
Severity: Warning

Message: fsockopen() [function.fsockopen]: Failed to enable crypto

Filename: libraries/Email.php

Line Number: 1673
I have also tried with
Quote:'smtp_host' => 'sslv2://smtp.live.com',
but it just wont work on my local machine.
I am using windows 7 on my local machine and windows Xp for the system I will use the application[the one which blocked gmail]. I tried with both XAMPP ver 1.8.1 and WAMPP ver 2.2

Looking forward for your responses :-)

~muttalebm
#2

[eluser]muttalebm[/eluser]
Wow No response yet! Can someone tell me whether this is a bug?
#3

[eluser]PhilTem[/eluser]
I don't know a lot about smtp/ssl/fsockopen, but a quick google search revealed that it might be different SSL protocol versions causing the problem i.e. you are trying to connect using SSL2 protocol while your server only talks SSL3 protocol.
But I don't know whether this is the actual problem nor do I know how to change that in the CI library.




Theme © iAndrew 2016 - Forum software by © MyBB