Reputation: 298
While I was finding a way to send a mail with PHP, I found the default mail() function in PHP, the Pear, and PHPMailer.
I was told that mail() function has many limitations, so I read a tutorial of Pear but I found that it needs installation. (My host service restricts library installation)
The last one, PHPMailer seems consist of php files and some documents.
So I would like to know that it does not need installation, just copy.
So I ask you that if I just copy some php files of the PHPMailer to use it.
If so, can I know some mandatory files to be copied? I want to keep minimal number of files in my small account.
Thanks in advance.
Upvotes: 3
Views: 2048
Reputation: 1417
Download PHPMailer, and the only file you need is class.phpmailer.php
.
Include it with:
require_once('class.phpmailer.php');
and then follow the example code to send your mail. That's all you need to get started :)
$mail = new PHPMailer();
$mail->SetFrom('[email protected]');
$mail->AddAddress('[email protected]');
$mail->Subject = "Test";
$mail->Body = "Testing PHPMailer.";
if(!$mail->Send()) echo "Mailer Error: " . $mail->ErrorInfo;
else echo "Message sent!"
Upvotes: 3