CodeIgniter Forums

Full Version: Email Message Problem
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum

[eluser]Kentish[/eluser]
Hello, am a beginner with codeigniter and php.

I have been following video tutorials and have completed till registration and email confirmation.

However, in the email, i want to send a proper text with formatting such as link and breaks.

Any guide on that please?

Else, can anyone help with the following code?

Code:
$body ="<table>";
        $body .="<tr><td>Thank you for registration.</td></tr>";
        $body .="<tr><td>To activate your account, please visit the following URL: </td></tr>";
        $body .="<tr><td><a href='http://localhost/ci/index.php/user/register_confirm/'>Here</a></td></tr>";
        $body .="<tr><td>Thank You.</td></tr>";
        $body .="</table>";
        
        $mailBody = $body;
        
        $data = array(
        "BODY" => $mailBody,
        );
        
        $this->email->message(); // i need to put the array in here, how do i do that?

El Forum

[eluser]CI_expert_indian[/eluser]
I am surprised that why are you using array to store $mailBody ? You can simply use this

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

But if you want to use array then you have to use $this->email->message($data['BODY']); ..... You can try the above procedures and please let me know for any query .

El Forum

[eluser]Kentish[/eluser]
Thanks

Both of the above works but still, the main problem am having has not yet been solved.

In the email, i still get :
Code:
<table><tr><td>Thank you for registration.</td></tr><tr><td>YouTo activate
your account, please visit the following URL: </td></tr><tr><td><a
href='http://localhost/ci/index.php/user/register_confirm/'>Here</a></td></tr><tr><td>Thank
You.</td></tr></table>

Any suggestion how to proceed please?

El Forum

[eluser]CI_expert_indian[/eluser]
Try this dear $this->email->mailtype(html) and let me know for any query .

El Forum

[eluser]Kentish[/eluser]
Yes, it finally works.

Thank you very much Smile

El Forum

[eluser]CI_expert_indian[/eluser]
You are most welcome dear always .....

El Forum

[eluser]CroNiX[/eluser]
If you are sending html email, it should be properly formatted starting with the doctype, html, head and body tags just like a regular webpage. Some mail readers won't read/display them unless it is properly formatted, valid html, which the specs call for anyway.