Welcome Guest, Not a member yet? Register   Sign In
Sending html email
#1

[eluser]PauloBr[/eluser]
My config/email.php:
Code:
$config['protocol'] = 'smtp';
$config['charset'] = 'iso-8859-1';
$config['mailtype'] = 'html';
$config['validate'] = TRUE;
$config['smtp_host'] = '*****';
$config['smtp_user'] = '*****';
$config['smtp_pass'] = '*****';
$config['newline'] = "\r\n";

And I have the results above:

- Sending simple text in:
Code:
$this->email->message('test');
Result: don't show any error, but I dont receive the e-mail

- Sending html code in:
Code:
$this->email->message($message_with_html);
Result: don't work

The error:
Quote:451 See http://pobox.com/~djb/docs/smtplf.html.
The following SMTP error was encountered: 451 See http://pobox.com/~djb/docs/smtplf.html.
Unable to send email using PHP SMTP. Your server might not be configured to send mail using this method.

Just work everything if I use mailtype 'text'. Sad

I alredy search in forum, but don't found any solution that works.

Thanks,
Paulo.
#2

[eluser]mikegioia[/eluser]
It seems that SMTP is either not configured or not configured correctly on your server. Have you tried the other protocols? Instead of SMTP try 'mail', that uses PHP's native mail function.

If that doesn't work, CI's user guide has the following to say about HTML mail messages:

Quote:Type of mail. If you send HTML email you must send it as a complete web page. Make sure you don't have any relative links or relative image paths otherwise they will not work.

Perhaps you're not sending a complete HTML page (with the <html><body></body></html&gtWink ?
#3

[eluser]webthink[/eluser]
Hi,

I've seen this a few times on qmail setups. You'll need to make a couple of changes to the Email library.

Around line 47 you'll want to make sure you have \r\n

Code:
var    $newline        = "\r\n";    // Default newline. "\r\n" or "\n" (Use "\r\n" to comply with RFC 822)
#4

[eluser]PauloBr[/eluser]
Hello!

@mikegioia

I think my SMTP is configure correctly, because if I try send with mailtye text, I receive the email.
And yes, my HTML have complete tags. =]

@webthink

This variable I sent in my configuration file email.php, here:
Code:
$config['newline'] = "\r\n";

I tried change at library too, unsuccessfully. =[


BUT... on library, I saw the variable $crlf with the value "\n" and I change to "\r\n" and apparently worked, but the email was not to my inbox.

Quote:Your message has been successfully sent using the following protocol: smtp

Thank for answers and new ideas are welcome!

[]'s
#5

[eluser]Peter Korsuize[/eluser]
Hi,

What SMTP server are you trying to connect to?

Also see my separate posting on a very similar (possibly the same) issue:
http://ellislab.com/forums/viewthread/76577/

PK
#6

[eluser]webthink[/eluser]
So, you're not getting the newline error from qmail, but the email is not delivered?
#7

[eluser]Peter Korsuize[/eluser]
Correct. As far as Codeigniter is concerned it has been sent successfully (after the "\r\n" change) but it never actually leaves the mail server. And the only clue is in the mail log where it is referring to a bad mime break.
#8

[eluser]webthink[/eluser]
If you view the raw message source, and then dump it into a text editor that will let you see the linefeeds (eg Notepad ++ View -> All characters) ... do you see any bare linefeeds?
#9

[eluser]Hazlitt[/eluser]
I have been trying to troubleshoot similar newline errors when sending emails.

I changed the $crlf variable in the email library file from:

var $crlf = "\n";

to:

var $crlf = "\r\n";

And this solved my problem




Theme © iAndrew 2016 - Forum software by © MyBB