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

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.gmail.com',
          'smtp_port' => 465,
          'smtp_user' => '*******',
          'smtp_pass' => '******',
          'mailtype'  => 'html', 
          'charset'   => 'iso-8859-1',
		  'starttls'  => true,
        );
			
      $this->load->library('email', $config);
      
	  $this->email->set_newline("\r\n");
	  
	  $this->email->from('****','Ramkumar');
      $this->email->to("*****");
      $this->email->subject("Test mail");
      $this->email->message("Test Mail using Php");
      $this->email->send();  
	  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



2) 
A PHP Error was encountered

Severity: Warning

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

Filename: libraries/Email.php

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

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.

http://www.w3schools.com/php/php_mail.asp[^]

http://php.net/manual/en/function.mail.php[^]

Hope this helps. :thumbsup:
 
Share this answer
 

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