0

I know this is a very common question but I just can't find the right answer to my question.

I'm using codeigniter with xampp and also this email server which is called miniRelay.

My configuration is this:

php.ini

extension=php_openssl.dll

[mail function]
; XAMPP: Comment out this if you want to work with an SMTP Server like Mercury
SMTP = 127.0.0.1
smtp_port = 25

; For Win32 only.
; http://php.net/sendmail-from
; sendmail_from = postmaster@localhost

(I have a 32bits windows 7 professional)

in my controller:

    $config = Array(
        'protocol' => 'smtp',
        'smtp_host' => 'ssl://smtp.gmail.com',
        // 'smtp_port' => 465,
        'smtp_port' => 25,
        'smtp_user' => 'mymail@gmail.com', 
        'smtp_pass' => 'mypass',
        'mailtype' => 'html',
        'charset' => 'iso-8859-1',
        'wordwrap' => TRUE
    ); 

    $this->load->library('email', $config);
    $this->email->set_newline("\r\n");

    $this->email->from(anothermail@gmail.com, "from contact form");
    $this->email->to("mymail@gmail.com");
     // $this->email->cc("testcc@domainname.com");
    $this->email->subject("This is test subject line");
    $this->email->message("Mail sent test message...");

    $data['message'] = "Sorry Unable to send email..."; 
    if($this->email->send()){     
        $data['message'] = "Mail sent...";   
    } 

Then, what I do is to turn on minirelay server on... it says that is listening to port 25 ... but then shows no activity when sending a test email.

The error that I'm getting is:

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

fsockopen(): Failed to enable crypto

fsockopen(): unable to connect to ssl://smtp.gmail.com:25 (Unknown error)

I'm not really a fan of protocols and I'm having a hard time... I would like some guidance please..

Limon
  • 1,772
  • 7
  • 32
  • 61
  • This may help https://www.youtube.com/watch?v=TO7MfDcM-Ho –  Mar 24 '16 at 22:04
  • Typically port 25 is reserved for smtp. Plain smtp does _not_ use ssl encryption. If you use smtp with ssl encryption then most likely your server will use another port for that. Alternatively you want to use starttls instead of ssl for encryption. Since that is an extension of the plain ssl protocol it is typically used on port 25. But still your server has to support it. – arkascha Mar 24 '16 at 22:05
  • @arkascha I removed ssl to just smtp.gmail.com and still does not work. Is it necessary a server like mini relay for this? Use it or not..it doesn't work – Limon Mar 24 '16 at 22:38
  • I am confused now. Before I thought that the gmail url in the code was meant as an example, but now it reads as if you are trying to connect directly to gmails smtp server? Then what is all that about that local smtp server you wrote about? You can only use one smtp server to communicate with, it is either or. The easier setup certainly is to use gmails server directly, since you do not have to setup any local server then. In your code you apparently configure both: you point to a local server in your php setup but then you specify a url in your code pointing to gmail. – arkascha Mar 25 '16 at 06:45
  • There appear to be successful attempts to send emails with your setup. I myself have no experience with codeigniter, also MS-Windows is very unfamiliar for me, like most software developers I prefer Linux, sorry. Example: http://stackoverflow.com/questions/1555145/sending-email-with-gmail-smtp-with-codeigniter-email-library What looks immediately odd is how you set your `FROM:` header. Put quote characters around the email address. And make sure that you enabled ssl usage for php as explained in the second answer to the question I cited above. – arkascha Mar 25 '16 at 07:02
  • @arkascha thanks for clearing my doubt with the smtp server. I realized that I had a mix of smtps, I could send an email with the config I wrote, the problem was in my gmail settings...I had to enable to receive emails from a "non secure" app – Limon Mar 27 '16 at 22:49

0 Answers0