Reputation: 2843
I have the following code that works on my localhost apache.
date_default_timezone_set('Etc/UTC');
require ('bin\PHPMailerAutoload.php');
$uname = "[email protected]";
$mail = new PHPMailer();
$mail->isSMTP();
$mail->SMTPDebug = 2;
$mail->Host = 'smtp.rybnikzahradne.sk';
$mail->SMTPSecure = 'tls';
$mail->Port = 25;
$mail->SMTPAuth = true;
$mail->Username = $uname;
$mail->Password = "********";
$mail->From = $uname;
$mail->AddAddress($uname);
$mail->Subject = $_POST["from"];
$mail->Body = $_POST["message"];
$mail->AltBody = 'sprava';
if (!$mail->send()) {
echo "Mailer Error: " . $mail->ErrorInfo;
} else {
echo "Message sent";
}
But when I upload it on my server it gives me this error:
Fatal error: require(): Failed opening required 'bin\PHPMailerAutoload.php' (include_path='.:/usr/php55/lib/php') in /nfsmnt/hosting2_1/3/b/3b4145df-8ba9-4552-835f-4e0224ac066d/rybnikzahradne.sk/web/objednavky3.php on line 5
Upvotes: 1
Views: 91
Reputation: 4465
While PHP will accept \
and /
on Windows, on *nix Systems you probably have to use /
as path-separator, so change your line to
require ('bin/PHPMailerAutoload.php');
and it should work on both systems.
Upvotes: 1