by Noah » Tue Nov 28, 2017 9:19 pm
This is only for the MIME type application/pdf
But I suspect someone can find the snippet to auto determine the mime type and hook in the variable
Copied the dispo_send_email.php
to dispo_send_email_withattach.php
Then make that change in the dispo url section on your campaign
After the section labeled check for variables in email_from you can copy the code below this line ##Attachment piece## to and replacing the existing sending email code
##### sending email through PHP #####
mail("$email_to","$email_subject","$email_body", "From: $email_from");
Look for this section
### check for variables in email_from
if (preg_match('/--A--/i',$email_from))
{
$email_from = preg_replace('/^VAR/','',$email_from);
$email_from = preg_replace('/--A--email--B--/i',"$email",$email_from);
$email_from = preg_replace('/--A--customer_email--B--/i',"$email",$email_from);
$email_from = preg_replace('/--A--agent_email--B--/i',"$agent_email",$email_from);
$email_from = urldecode($email_from);
}
Start copy from here
##Attachment piece##
$filename = 'YOUR.pdf';
$path = '../mcc';
$file = $path . "/" . $filename;
// Grab and encode the content can be in a directory of your choice but adjust the path above
$content = chunk_split(base64_encode(file_get_contents($file)));
// a random hash will be necessary to send mixed content
$separator = md5(time());
// standard mail headers
$headers = "From: ".$email_from."\r\n";
$headers .= "Reply-To: ".$email_from. "\r\n";
$headers .= "MIME-Version: 1.0\r\n";
// declare multiple kinds of email (plain text + attch)
$headers .= "Content-Type: multipart/mixed; boundary=\"".$separator."\"\r\n\r\n";
$headers .= "This is a multi-part message in MIME format.\r\n";
// message plain txt part
$headers .= "--".$separator."\r\n";
$headers .= "Content-Type:text/plain; charset=\"iso-8859-1\r\n";
$headers .= "Content-Transfer-Encoding: 7bit\r\n\r\n";
$headers .= $email_body. "\r\n\r\n";
// attachment
$headers .= "--".$separator."\r\n";
$headers .= "Content-Type:application/pdf; name=\"".$filename."\"\r\n";
$headers .= "Content-Transfer-Encoding: base64\r\n";
$headers .= "Content-Disposition: attachment; filename=\"".$filename.$file."\"\r\n\r\n";
$headers .= $content."\r\n\r\n";
##### sending email through PHP #####
// mail("$email_to","$email_subject","$email_body", "From: $email_from"); NOT NEEDED
if(mail("$email_to","$email_subject", "", "$headers")) {
echo "The email was sent.";
}
else {
echo "There was an error sending the mail.";
print_r( error_get_last() );
}
MyCallCloud.com - Cool Vici Customizations - Hosted - Configured - Supported
Web: https://mycallcloud.com
P: 888-663-0760
E: sales@mycallcloud.com