Jump to content

sending email help


narjis

Recommended Posts

Hi,

I want to send an email to my registered users so that when they click on the URL given in the message hey should come back to my site as confirmetion of their registration. I am able to send the mail but the mail body is not coming as expected. Here's my code

<?php
   public function email($id){
        //get users info
       $this->userInfo = $this->model->listUser($id);
       $this->sendEmail($this->userInfo);
    }
    public function sendEmail($data){
       
        $to =$data['email'];
        
        
        $this->msg ="<img src=\"ideas.kpjit.com/public/images/header-img.jpg\" />

          <h1>KPJ Idea</h1>
          <p>Make a difference</p>
                <p>This is a Confirmation Mail.Please confirm your registration
            by clicking here <a href=\"http://ideas.kpjit.com\register\confirm\
                    <?php echo $this->data['id'];?></p>\" ";
        
        $subject = "Registration confirmation";
        $message = $this->msg;
        $from ="[email protected]";
        $headers  = 'MIME-Version: 1.0' . "\r\n";
        $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
        $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
        $headers .= 'From:[email protected]' . "\r\n";
        if(mail($to,$subject,$headers)){
     
        $this->render2("register/message");
        exit;
        }
    }

 

Also I am unable to insert my site banner in the mail. How can I do It.

Link to comment
https://forums.phpfreaks.com/topic/249172-sending-email-help/
Share on other sites

try this:

$this->msg ="<img src=\"http://ideas.kpjit.com/public/images/header-img.jpg\" />

          <h1>KPJ Idea</h1>
          <p>Make a difference</p>
                <p>This is a Confirmation Mail.Please confirm your registration
            by clicking here <a href=\"http://ideas.kpjit.com\register\confirm\".$this->data['id']."</p>\" ";

Link to comment
https://forums.phpfreaks.com/topic/249172-sending-email-help/#findComment-1279664
Share on other sites

why am i not getting any message in my mail body i've tried the last message nothing is appearing in mail accept this

 

MIME-Version: 1.0

Content-type: text/html; charset=iso-8859-1

From:[email protected]

 


$this->msg ='<img src=\"http://ideas.kpjit.com/public/images/header-img.jpg\" />
          <h1>KPJ Idea</h1>
          <p>Make a difference</p>
                <p>This is a Confirmation Mail.Please confirm your registration
            by clicking here <a href=\"http://ideas.kpjit.com\register\confirm\"'.$this->data['id'].'"</p>\" "';
     
        $subject = "Registration confirmation";
        $message = $this->msg;
        $from ="[email protected]";
     
        $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
        $headers .= 'From:[email protected]' . "\r\n";
        if(mail($to,$subject,$headers)){
     
        $this->render2("register/message");
        exit;
        }

shall I remove the headers

 

Link to comment
https://forums.phpfreaks.com/topic/249172-sending-email-help/#findComment-1280406
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.