How to send xml (like attachment) in phpMailer
<pre><code>    $myXML = 
        '&lt;?xml version="1.0" encoding="ISO-8859-2"?&gt;
        &lt;Document-ORDRES&gt;
            &lt;ORDRES-Header&gt;
                &lt;OrderResponseNumber&gt;123&lt;/OrderResponseNumber&gt;
                &lt;OrderResponseDate&gt;0&lt;/OrderResponseDate&gt;
                &lt;BuyerOrderNumber&gt;0&lt;/BuyerOrderNumber&gt;
                &lt;BuyerOrderDate&gt;0&lt;/BuyerOrderDate&gt;
                &lt;DeliveryDate&gt;0&lt;/DeliveryDate&gt;
            &lt;/ORDRES-Header&gt;
        &lt;/Document-ORDRES&gt;';    

$xml=simplexml_load_string($myXML) or die("Error: Cannot create object");

public function send_mail($xml){
    print_r($xml);
    echo "&lt;/br&gt;&lt;/br&gt;";
    $data;
    require 'C:\xampp\htdocs\PHPMailer-master\PHPMailerAutoload.php';

    header('Content-Type: text/html; charset=utf-8');
    $mail = new PHPMailer;
    $mail-&gt;isSMTP();
    $mail-&gt;SMTPDebug = 2;
    $mail-&gt;Debugoutput = 'html';
    $mail-&gt;Host = "...";
    $mail-&gt;Port = 587;
    $mail-&gt;SMTPOptions = array(
        'ssl' =&gt; array(
            'verify_peer' =&gt; false,
            'verify_peer_name' =&gt; false,
            'allow_self_signed' =&gt; true
        )
    );
    $mail-&gt;SMTPAuth = true;

    $mail-&gt;Username = "...";
    $mail-&gt;Password = "...";
    $mail-&gt;setFrom('...', '...');
    $mail-&gt;addAddress('...', '');
    $mail-&gt;Subject = '...';
    $mail-&gt;AltBody = " ";
    $mail-&gt;msgHTML("Test");
    $mail-&gt;addAttachment($xml, "xml.xml");
    if (!$mail-&gt;send()) {
        echo "Mailer Error: " . $mail-&gt;ErrorInfo;
    } else {
        echo "Message sent!";
    }
}
</code></pre>

<p>Can you tell me what should I do?
I want send this xml like attachment, but in mail I haven't got attachments. 
I've got just e-mail text.</p>