无法使用Codeigniter发送其他域邮件ID

时间:2019-03-02 06:32:13

标签: codeigniter

<?php

`unable to send other domain mail id using codeigniter`

    $this->load->library('email'); <BR>
    $to = 'otherdomain@example.org';<BR>
    $from = $this->input->post('Email');<BR>
    $fromName = $this->input->post('Name');<BR>
    $mailSubject = 'Contact Request Submitted by '.$fromName;<BR>
    $message = $this->input->post('Message');<BR>
    $this->email->from($from, 'name'); <Br>
    $this->email->to($to); <Br>
    $this->email->subject('Email Test'); <Br>
    $this->email->message('Testing the email class.');<BR>
    $this->email->send();
?>

1 个答案:

答案 0 :(得分:0)

尝试一下,它将起作用...

            $config['protocol'] = 'smtp';

            $config['smtp_host'] = 'mail.domain.com';

            $config['smtp_port'] = '587';

            $config['smtp_timeout'] = '7';

            $config['smtp_user'] = 'domain email here';

            $config['smtp_pass'] = 'email password here';

            $config['charset'] = 'utf-8';

            $config['newline'] = "\r\n";

            $config['mailtype'] = 'html'; // or html

            $config['validation'] = TRUE; // bool whether to validate email or not      

            $this->email->initialize($config);
            $this->email->from('email here', 'Email Name');
            $this->email->to('email to');

            $this->email->subject('subject here');



            $this->email->message('message here');


            $this->email->send();