L
L
Lucker_Kophe2020-11-13 23:34:49
PHP
Lucker_Kophe, 2020-11-13 23:34:49

Does htaccess affect the PHPMailer library?

Hello, I have a question about the PHPMailer library. Before adding the htaccess file, everything worked correctly. After adding htaccess, PHPMailer began to give an error related to incorrect SMTP connection - 'SMTP connect() failed'. If suddenly htaccess cannot influence this in any way, tell me in which direction to dig.

PHP Code:

$subject = "AERIAL PHOTO";

$name = $_POST['name'];
$email = $_POST['email'];
$phone = $_POST['phone'];
$message = $_POST['message'];

require_once('../../phpmailer/PHPMailerAutoload.php');

$mail = new PHPMailer(true);
$mail->CharSet = 'UTF-8';

$mail->SMTPOptions = array(
'ssl' =>
'verify_peer_name' => false,
'allow_self_signed' => true
)
);

$mail->isSMTP();
$mail->Host = 'smtp.mail.ru'; // Specify main and backup SMTP servers
$mail->SMTPAuth = true;
$mail->Username = '[email protected]';
$mail->Password = 'XXXXX';
$mail->SMTPSecure = 'ssl';
$mail->Port = 465;

$mail->setFrom('[email protected]');
$mail->addAddress('[email protected]');
$mail->isHTML(true);

$mail->Subject = $subject;
$mail->Body = ''.$name . '
'.$phone.'
'.$email.'
'.$message;
$mail->AltBody = '';

if(!$mail->send()) {
echo $mail->ErrorInfo;
} else {
header('Location: index.html');
}

htaccess code:

RewriteEngine On

RewriteCond %{THE_REQUEST} " /dop_pages/([^?]+)/index\.html"
RewriteRule ^ /%1/ [R=301,L,NE]

RewriteCond %{DOCUMENT_ROOT}/dop_pages /$1/index.html -f
RewriteRule ^(.+)/$ /dop_pages/$1/index.html [L]

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question