D
D
Dmitry2018-10-13 21:00:20
PHP
Dmitry, 2018-10-13 21:00:20

Why don't attachments come to a mail.ru email?

I am using phpmailer
php handler example

<?php
  
// Файлы phpmailer
require 'class.phpmailer.php';
require 'class.smtp.php';

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

// Настройки
$mail = new PHPMailer;

// Кодировка
$mail->CharSet = 'UTF-8';


//$mail->isSMTP(); 
$mail->Host = 'ssl://smtp.mail.ru';  
$mail->SMTPAuth = true;                      
$mail->Username = 'XXXX'; // Ваш логин в Mail.ru. Именно логин, без @mail.ru
$mail->Password = 'XXXX'; // Ваш пароль
$mail->SMTPSecure = 'ssl';                            
$mail->Port = 465;

$mail->setFrom($name); 
$mail->FromName = $name; 

$mail->addAddress('[email protected]'); // Email recipient

//$mail->addAddress('[email protected]'); // Another email if needed.

// Attaching Files
 for ($ct = 0; $ct < count($_FILES['file']['tmp_name']); $ct++) {
        $uploadfile = tempnam(sys_get_temp_dir(), sha1($_FILES['file']['name'][$ct]));
        $filename = $_FILES['file']['name'][$ct];
        if (move_uploaded_file($_FILES['file']['tmp_name'][$ct], $uploadfile)) {
            $mail->addAttachment($uploadfile, $filename);
        } else {
            $msg .= 'Failed to move file to ' . $uploadfile;
        }
    }   
                                 
// Письмо
$mail->isHTML(true); 

// Заголовок письма
$mail->Subject = "Form name"; 

// Текст письма
$message = "Имя : " . $name . "<br>" . " Телефон : " . $phone ;
$mail->Body = $message;

// Результат
if(!$mail->send()) {
    echo 'Message could not be sent.';
    echo 'Mailer Error: ' . $mail->ErrorInfo;
} else {
    echo '';
}
?>

At my hosting - a mail.ruletter with an attachment arrives in the mail
The customer receives a letter, but without an attachment
What could be the reason?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dimonchik, 2018-10-13
@dimonchik2013

at the customer too meylru? You understand that this cannot be, except perhaps anti-spam, but then everything is spam at the customer

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question