【问题标题】:Add logo image at footer of email using Codeigniter 3使用 Codeigniter 3 在电子邮件页脚添加徽标图像
【发布时间】:2020-04-20 12:14:08
【问题描述】:

我正在尝试在电子邮件末尾添加徽标(关于部分),但我只能发送图片链接,请帮助我,提前感谢,感谢您的宝贵时间。

这是我的代码

    public function sendMailToClient(){
    $subject = "park Group of Hotels.";
    $message = '
    <p>Hello'.$this->input->post('add_name').', <br>Greetings from park!<br> Thanks for choosing Hotel park! We aim to make your stay luxurious and comparting.
    <br>
    we will call and confirm you soon.You can also reach us on _+91 973255 </p>

      <br>
      <br>

    <div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
    Regards,</div>
    <div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
    park Group of Hotels</div>

    <img src="/hotelempark/assests/img/Logo_1.png" alt="Hotel Empark">


    ';

    $this->load->library('email');

        $this->email->set_newline("\r\n");                
        $this->email->from('abcd@gmail.com'); 
        $this->email->to($this->input->post('email'));

        $this->email->subject($subject);
        $this->email->message($message);

        // $this->email->cc('another@example.com');
        // $this->email->bcc('and@another.com');


        $mail= $this->email->send();
        if($mail>0){
          $this->session->set_flashdata('message', 'Thanks for Booking Room In Our Hotel, We will Call You Soon');
          $this->email->to($this->input->post('add_email'));

        }else{

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

    }
  }

电子邮件发送成功,但我的图片没有加载。

【问题讨论】:

  • 究竟是什么图像?该代码中似乎没有任何图像
  • 先生,请检查,我已经编辑了代码,很抱歉沟通不畅
  • 图片不显示,因为在邮件客户端/hotelempark/assests/img/Logo_1.png 不存在。您需要使用您的完整域 &lt;img src="https://example.com/hotelempark/assests/img/Logo_1.png"&gt;(或嵌入图像),以便邮件客户端知道从哪里加载图像

标签: php codeigniter email


【解决方案1】:
$message = '
<p>Hello'.$this->input->post('add_name').', <br>Greetings from park!<br> Thanks for choosing Hotel park! We aim to make your stay luxurious and comparting.
<br>
we will call and confirm you soon.You can also reach us on _+91 973255 </p>

  <br>
  <br>

<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
Regards,</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
park Group of Hotels</div>

<img src="https://www.Yourdomain.com/hotelempark/assests/img/Logo_1.png" alt="Hotel Empark">


';

您只需更改 URL 并添加基本 URL。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2020-06-13
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多