Using CodeIgniter Framework
If the application uses the CodeIgniter Framework you can remedy the email problem with this simple code. For complete functionalities, consult the documentation on www.codeigniter.com/docs
$this->load->library(’email’);
$this->email->from(‘noreply@momit.eu’, ‘Momit SRL’);
$this->email->to($email); // $email = “email_id”
$this->email->subject(‘Welcome to Momit.’);
$this->email->message(‘<html>
<head>
</head>
<body>
<p><b>Here write the content of the email..</b></p>
</body>
</html>’);
$this->email->send();
Using the PEAR library
The PEAR library has also integrated the management function for sending mail and supports SMTP authentication using an existing account defined on the domain.
include(‘Mail.php’); // PEAR Mail function
$headers = array (‘From’ => $from, ‘To’ => $to, ‘Subject’ => $subject);
// mail header
$smtp = Mail::factory(‘smtp’, array (‘host’ => “localhost”, ‘auth’ => true,
‘username’ => $username, ‘password’ => $password, ‘port’ => ‘587’));
// SMTP parameters
$mail = $smtp->send($to, $headers, $body); // sending mail