1

I make email function in CodeIgniter and when I set "mailtype = html" I can't send long text but when I set "mailtype = text" I can send email in a long text. I don't know why?

I want to send email with "emailtype=html" because I want to use bold, italic, etc in my message

this my setting

$config = array(
    'protocol' => 'smtp',
    'smtp_host'=> 'my IP address',
    'smtp_port' => '25',
    'smtp_user' => 'my email address',
    'mailtype' => 'text',
    'charset' => '465',
    'wordwrap' => 'TRUE'
 );

$this->load->library('email', $config);
$this->email->set_newline("\r\n");
$this->email->from('helpdesk@acc.co.id','ITCareHelpdesk ACC');
$this->email->to('dpalevi@gmail.com');
$this->email->subject('[ITCARE] Reminder Request Approval ITCare ACC');
$this->email->message('');

I try to use lorem ipsum in my message when my "mailtype = text" for check it, and I can send email, but when I use "mailtype = html" I can't send my message

Abdulla Nilam
  • 36,589
  • 17
  • 64
  • 85

1 Answers1

1

First thing is you're not using PHPMailer library. You're using CodeIgniter mail function.

$config = array(
    'protocol' => 'smtp',
    'smtp_host'=> '172.16.5.20',
    'smtp_port' => '25',
    'smtp_user' => 'helpdesk@acc.co.id',
    'mailtype' => 'html',
    'charset' => 'iso-8859-1', # can use utf-8 as well
    'wordwrap' => 'TRUE'
 );

Make sure your port works using telnet

telnet smtp.domain.com 25

Q - how many characters is allowed in phpmailer
A - As I know there is no limitation in SMTP mail

halfer
  • 19,824
  • 17
  • 99
  • 186
Abdulla Nilam
  • 36,589
  • 17
  • 64
  • 85
  • I try it and still can't send my message, I check my port and my port is not using telnet @AbdullaNilam – Rizki Pahlevi Oct 18 '17 at 08:52
  • I check it and my port is working, and I still dont know why I can't send email with long text like lorem ipsum when my "mailtype=html" but when I change it to "emailtype=text" my message is send @AbdullaNilam – Rizki Pahlevi Oct 18 '17 at 09:20
  • test with gmail smtp. I never had this kinda issue. – Abdulla Nilam Oct 18 '17 at 09:20
  • In the end I still use 'mailtype' => 'text', I read in the documentation codeigniter, if I want use 'mailtype' => 'html' I must send it as a complete web page, I try make it, but still not working. thanks for you help @AbdullaNilam – Rizki Pahlevi Oct 19 '17 at 03:21