Click here to Skip to main content
15,076,991 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:

How to send mail using php..
Please help me to clear the following errors..Thanks in advance,

My code is:

$config = Array
          'protocol' => 'smtp',
          'smtp_host' => '',
          'smtp_port' => 465,
          'smtp_user' => '*******',
          'smtp_pass' => '******',
          'mailtype'  => 'html', 
          'charset'   => 'iso-8859-1',
		  'starttls'  => true,
      $this->load->library('email', $config);
      $this->email->subject("Test mail");
      $this->email->message("Test Mail using Php");
	  echo $this->email->print_debugger(); die;

My Errors after trying to run:

1) A PHP Error was encountered

Severity: Warning

Message: fsockopen(): unable to connect to localhost:25 (An attempt was made to access a socket in a way forbidden by its access permissions. )

Filename: libraries/Email.php

Line Number: 1689

A PHP Error was encountered

Severity: Warning

Message: fwrite() expects parameter 1 to be resource, boolean given

Filename: libraries/Email.php

Line Number: 1846
Updated 21-Sep-13 2:51am

1 solution

Why not using the standard ways W3C and PHP recommends?

Take a look at those links in which there are even samples on how to send e-mails.[^][^]

Hope this helps. :thumbsup:

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900