We have an internal api that sends faxes directly from our database using php mailer. it sends both email and fax. for internal control purposes we need to continue to use this method rather than a new API just for faxes. It sends the fax / cover page, but does not send the pdf attachment.
PHP:
$fax = "111-222-3333";
$mail = new PHPMailer(true); // Passing `true` enables exceptions
$mail->SMTPOptions = array('ssl' => array('verify_peer' => false, 'verify_peer_name' => false));
$mail->CharSet = 'UTF-8';
$mail->Encoding = "base64";
try {
//Server settings
$mail->isSMTP(); // Set mailer to use SMTP
$mail->Host = 'localhost'; // Specify main and backup SMTP servers
$mail->SMTPSecure = 'tls'; // use TLS
$mail->Port = 587; // TCP port to connect to
$mail->setFrom($faxFrom);
$mail->addReplyTo($faxFrom);
$sFax2 = $fax . "@rcfax.com";
$mail->addAddress($sFax2); // Add a recipient
$mail->addAttachment($tmpfname . "_bcst.pdf", "Home Report"); // Add attachments
//Content
$sSubject = "BROADCAST " . $home->FacilityName . " - " . $client->getStrName() . " - REFID:" . $row->id; // . " - FLID:" . $fl->id;
$mail->Subject = $sSubject;
$mail->Body = " ";
$mail->isHTML(false);
$mail->send();
} catch (Exception $e) {
}
}
peter@middleware:~$ cat /mnt/BinaryData/2022/FL107248.txt
SERVER -> CLIENT: 220 api.ca***nt.com ESMTP Postfix (Ubuntu)
CLIENT -> SERVER: EHLO api.ca***nt.com
SERVER -> CLIENT: 250-api.ca***nt.com
250-PIPELINING
250-SIZE 50000000
250-VRFY
250-ETRN
250-STARTTLS
250-AUTH PLAIN LOGIN
250-AUTH=PLAIN LOGIN
250-ENHANCEDSTATUSCODES
250-8BITMIME
250-DSN
250 SMTPUTF8
CLIENT -> SERVER: STARTTLS
SERVER -> CLIENT: 220 2.0.0 Ready to start TLS
CLIENT -> SERVER: EHLO api.ca***nt.com
SERVER -> CLIENT: 250-api.ca***nt.com
250-PIPELINING
250-SIZE 50000000
250-VRFY
250-ETRN
250-AUTH PLAIN LOGIN
250-AUTH=PLAIN LOGIN
250-ENHANCEDSTATUSCODES
250-8BITMIME
250-DSN
250 SMTPUTF8
CLIENT -> SERVER: MAIL FROM:<fax@ca***nt.com>
SERVER -> CLIENT: 250 2.1.0 Ok
CLIENT -> SERVER: RCPT TO:<888-812-6909@rcfax.com>
SERVER -> CLIENT: 250 2.1.5 Ok
CLIENT -> SERVER: DATA
SERVER -> CLIENT: 354 End data with <CR><LF>.<CR><LF>
CLIENT -> SERVER: Date: Fri, 21 Oct 2022 17:12:53 -0700
CLIENT -> SERVER: To: 888-812-6909@rcfax.com
CLIENT -> SERVER: From: fax@ca***nt.com
CLIENT -> SERVER: Reply-To: fax@ca***nt.com
CLIENT -> SERVER: Subject: BROADCAST Sanitized Subject - REFID:146230
CLIENT -> SERVER: Message-ID: <SNwrVIZ66yO9ff6ReAhARR2VGYT86DKoIdNAK9zh0@api.ca***nt.com>
CLIENT -> SERVER: X-Mailer: PHPMailer 6.0.3 (https://github.com/PHPMailer/PHPMailer)
CLIENT -> SERVER: MIME-Version: 1.0
CLIENT -> SERVER: Content-Type: multipart/mixed;
CLIENT -> SERVER: boundary="b1_SNwrVIZ66yO9ff6ReAhARR2VGYT86DKoIdNAK9zh0"
CLIENT -> SERVER:
CLIENT -> SERVER: This is a multi-part message in MIME format.
CLIENT -> SERVER: --b1_SNwrVIZ66yO9ff6ReAhARR2VGYT86DKoIdNAK9zh0
CLIENT -> SERVER: Content-Type: text/plain; charset=UTF-8
CLIENT -> SERVER: Content-Transfer-Encoding: base64
CLIENT -> SERVER:
CLIENT -> SERVER: IA==
CLIENT -> SERVER:
CLIENT -> SERVER: --b1_SNwrVIZ66yO9ff6ReAhARR2VGYT86DKoIdNAK9zh0
CLIENT -> SERVER: Content-Type: application/pdf; name="Home Report"
CLIENT -> SERVER: Content-Transfer-Encoding: base64
CLIENT -> SERVER: Content-ID: <Home Report>
CLIENT -> SERVER: Content-Disposition: attachment; filename="Home Report"
CLIENT -> SERVER:
CLIENT -> SERVER: JVBERi0xLjQKMSAwIG9iago8PAovVGl0bGUgKP7/AEIAcgBvAGEAZABjAGEAcwB0KQovQ3JlYXRv
CLIENT -> SERVER: ciAo/v8AdwBrAGgAdABtAGwAdABvAHAAZABmACAAMAAuADEAMgAuADQpCi9Qcm9kdWNlciAo/v8A
...
CLIENT -> SERVER: MDI1NTQ5IDAwMDAwIG4gCjAwMDAwMzQxODUgMDAwMDAgbiAKMDAwMDAzNDY0MyAwMDAwMCBuIAow
CLIENT -> SERVER: MDAwMDM0MTY0IDAwMDAwIG4gCnRyYWlsZXIKPDwKL1NpemUgMjcKL0luZm8gMSAwIFIKL1Jvb3Qg
CLIENT -> SERVER: MTIgMCBSCj4+CnN0YXJ0eHJlZgozNTcyMQolJUVPRgo=
CLIENT -> SERVER:
CLIENT -> SERVER: --b1_SNwrVIZ66yO9ff6ReAhARR2VGYT86DKoIdNAK9zh0--
CLIENT -> SERVER:
CLIENT -> SERVER: .
SERVER -> CLIENT: 250 2.0.0 Ok: queued as 04268A2017C
CLIENT -> SERVER: QUIT
SERVER -> CLIENT: 221 2.0.0 Bye
peter@middleware:~$