Friday 3 April 2015

PHP mail using SMTP


In Codigniter is use this PHP Code to send mail using SMTP

Simple Mail Transfer Protocols :)


        $mail = array();
        $mail["protocol"] = "smtp";
        $mail["smtp_host"] = "ssl://p3plcpnl019.prod.phx3.secureserver.net";
        $mail["smtp_port"] = 465;
        $mail["smtp_user"] = "Your Email Address";
        $mail["smtp_pass"] = "Your Address";
      
         $this->load->library("email", $mail);
         $this->email->set_newline("\r\n");
        
         //set email information and content
         $this->email->from("support@gerosport.com", "GeroSport");
         $this->email->to($to);
        
         $this->email->subject($subject);
   
         $this->email->message($msg);
        
         if($this->email->send())
         {
            $response = 1;
         } else {
            $response = 0;
         }



Also i get help from :-
http://asif18.com/7/php/send-mails-using-smtp-in-php-by-gmail-server-or-own-domain-server/




Simple Mail Transfer Protocols :)

Download smtp here:
https://drive.google.com/file/d/0B-fLDe0BHeR9TXg1Z0Z4ZS1mc1k/view?usp=sharing

<?php
require("YOUR PATH TO/PHPMailerAutoload.php");

$mail = new PHPMailer();
$mail->IsSMTP();
$mail->SMTPDebug = 0;
$mail->SMTPAuth = 'login';
$mail->SMTPSecure = 'ssl';
$mail->Host = 'smtp.gmail.com';
$mail->Port = 465;
$mail->Username = 'YOUR MAIL ID';
$mail->Password = 'YOUR PASSWORD';
$mail->SetFrom('REFERENCE EMAIL ID', 'REFERENCE NAME');
$mail->Subject = "YOUR SUBJECT HERE..";
$mail->Body = "MESSAGE BODY HERE..";
$mail->IsHTML(true);
$mail->AddAddress("SENDER EMAIL ID..");
$mail->Send();
?>

No comments:

Post a Comment