0

Hello i am working windows 7 and online server. I want that the visitor send me a mesaj from contact form but when i click the submit button a problem occurs.

this is my controller;

public function ilet(){
        $name    = $this->input->post("name");
        $email   = $this->input->post("email");
        $message = $this->input->post("message");

        $config = array(
            "protocol"    => "smtp",
            "smtp_host"   => "smtp.gmail.com",
            "smtp_port"   =>"587",
            "smtp_user"   =>"dcugurel7@gmail.com",
            "smtp_password"   =>"*******",
            "starttls"    =>true,
            "charset"     =>"utf-8",
            "mailtype"    =>"html",
            "wordwrap"    => true,
            "newline"     =>"\r\n",
        );

        $this->load->library("email", $config);

         $this->email->from("cugurel7@gmail.com");
         $this->email->to("cugurel7@gmail.com");             
         $this->email->subject("Müşteri bilgi mesajı");
         $this->email->message("Kişinin Adı - " . $name .
          " - Kişinin Email Adresi - " . $email . " - Kişinin Mesajı - " . $message);


         $send = $this->email->send();

         if($send)
         {
             echo "Mail gönderme işlemi başarılı";
         }
         else {
             echo "Başarısız<br>;";

             echo $this->email->print_debugger();

         }


    }

bu when i click to submit button server says that ;

220 smtp.gmail.com ESMTP y189-v6sm1286718wmd.19 - gsmtp hello: 250-smtp.gmail.com at your service, [185.85.237.26] 250-SIZE 35882577 250-8BITMIME 250-STARTTLS 250-ENHANCEDSTATUSCODES 250-PIPELINING 250-CHUNKING 250 SMTPUTF8 Failed to send AUTH LOGIN command. Error: 530 5.7.0 Must issue a STARTTLS command first. y189-v6sm1286718wmd.19 - gsmtp

Unable to send email using PHP SMTP. Your server might not be configured to send mail using this method.

Can you please help me how can i fix this?

cugurel
  • 27
  • 1
  • 9

1 Answers1

0

You connection code might be incorrect, take a look at this post and try this - Send email using the GMail SMTP server from a PHP page

Kory
  • 1,266
  • 3
  • 12
  • 29
  • no sir. last night i use windows 10 and it was successfull. :( – cugurel Jul 11 '18 at 07:24
  • Try it again on win 10 (as sanity check to verify your code still works) Is this a new win 7 install? temporarily disable firewall, try to get your win 7 environment to match your win 10 as best you can – Kory Jul 11 '18 at 07:52