Email Signature and attachement

Discussions about new features or changes in existing features

Moderators: gerski, enjay, williamconley, Op3r, Staydog, gardo, mflorell, MJCoate, mcargile, Kumba, Michael_N

Email Signature and attachement

Postby kojiromusashi » Fri Jun 02, 2017 9:14 pm

Hi, we have a client that would like to send email automatically after selecting the right disposition which I believe is resolve by checking in this forum however they also ask to include a pdf attachment and an email signature. Would this be possible or is there any other work around on this?

Thank you.

ViciDial
VERSION: 2.14-615a
BUILD: 170516-0632
single server no added software or hardware
kojiromusashi
 
Posts: 3
Joined: Mon Feb 29, 2016 10:54 am

Re: Email Signature and attachement

Postby jjohnson78 » Fri Jun 02, 2017 9:53 pm

Hello,

Yes, as stated in another post, it IS possible for you to write this yourself and using the Dispo Call URL feature. The PHP coding language does have the capability of sending emails with attachment, and you'd need to write a PHP program that will be called via the Dispo Call URL feature, which will include coding to send an email if the status being passed is the one you're looking for. Someone supplied a php page, dispo_send_email.php, which will do almost all that you've described.

However, I'm sure you noticed this script does not include email attachments. So, you could try making a customized version of this, as PHP does support sending emails with attachments - here's a page that tells one way to do it:

http://webcheatsheet.com/php/send_email ... chment.php

You could patch the dispo_send_email.php to include attachments and signatures, maybe make a "dispo_send_email_with_attachments.php" to test with. This might work for you if you're only looking to have one particular attachment and one particular signature go out for every email. If you want a different attachment per disposition, or a different signature per agent, then you're getting into more complicated territory and you'd have to code appropriately. There's several ways you could go about doing this.
jjohnson78
 
Posts: 40
Joined: Thu May 08, 2008 8:18 am

Re: Email Signature and attachement

Postby kojiromusashi » Sat Jun 03, 2017 12:31 am

thank you very much jjohmson78 for the response. I'll try this and post back here for any positive outcome. Again thank you very much.
kojiromusashi
 
Posts: 3
Joined: Mon Feb 29, 2016 10:54 am

Re: Email Signature and attachement

Postby 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
P: 888-663-0760
E: sales@mycallcloud.com
Noah
 
Posts: 81
Joined: Tue Feb 08, 2011 7:14 pm

Re: Email Signature and attachement

Postby mflorell » Wed Nov 29, 2017 12:12 am

Please post enhancements like this to the Issue Tracker.
mflorell
Site Admin
 
Posts: 16336
Joined: Wed Jun 07, 2006 2:45 pm
Location: Florida

Re: Email Signature and attachement

Postby Noah » Tue Dec 05, 2017 9:37 pm

mflorell wrote:Please post enhancements like this to the Issue Tracker.


It doesn't feel complete for any type of MIME type media. Still want posted to mantis?
MyCallCloud.com - Cool Vici Customizations - Hosted - Configured - Supported
P: 888-663-0760
E: sales@mycallcloud.com
Noah
 
Posts: 81
Joined: Tue Feb 08, 2011 7:14 pm

Re: Email Signature and attachement

Postby mflorell » Wed Dec 06, 2017 6:08 am

We would like any code contributions(even ones that are not complete) to be posted to the issue tracker, since that is always where we check first before we begin a project to look for similar projects that may not be complete to save time in development.
mflorell
Site Admin
 
Posts: 16336
Joined: Wed Jun 07, 2006 2:45 pm
Location: Florida


Return to Features

Who is online

Users browsing this forum: No registered users and 11 guests