Alright, through some messing around I was able to find a solution for this problem. I am a novice when it comes to JS, php/AJAX so my fix is probably not the optimal way to do this. If anyone has any tips to make my changes better please let me know.
Inside of include/javascript/sugar_grp1.js search for the line that contains use_external_mail_client and delete the function. Replace it with
Code:
function getXMLHttp()
{
var xmlHttp
try
{
//Firefox, Opera 8.0+, Safari
xmlHttp = new XMLHttpRequest();
}
catch(e)
{
//Internet Explorer
try
{
xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
}
catch(e)
{
try
{
xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
}
catch(e)
{
alert("Your browser does not support AJAX!")
return false;
}
}
}
return xmlHttp;
}
sugarListView.prototype.use_external_mail_client=function(no_record_txt){selected_records=sugarListView.get_checks_count();
if(selected_records<1){
alert(no_record_txt);
}
else{
inputs=document.MassUpdate.elements;ar=new Array();for(i=0;i<inputs.length;i++){if(inputs[i].name=='mass[]'&&inputs[i].checked&&typeof(inputs[i].value)!='function'){ar.push(inputs[i].value);}
var mailids=ar.join(',');}
var xmlHttp = getXMLHttp();
xmlHttp.onreadystatechange = function()
{
if(xmlHttp.readyState == 4)
{
location.href=xmlHttp.responseText;
}
}
xmlHttp.open("GET", 'externalmail.php' + mailids, true);
xmlHttp.send(null);
}
return false;} Then, create a file named externalmail.php and paste
Code:
<?php
$username="yourusername";
$database="sugarcrm";
$dbId = $_GET[IDs];
$ids = explode(",", $dbId);
$command = "\"";
foreach ($ids as $p){
$p = mysql_real_escape_string($p);
$command .= $p;
$command .= "\",\"";
}
$command = substr($command,0,-2);
mysql_connect(localhost,$username);
@mysql_select_db($database) or die( "Unable to select database");
$query2 = "SELECT email_addresses.email_address AS email_addresses_email_address FROM email_addr_bean_rel, email_addresses WHERE email_addr_bean_rel.bean_id IN ($command) AND email_addr_bean_rel.email_address_id = email_addresses.id AND email_addr_bean_rel.deleted = 0 AND email_addresses.deleted = 0";
$result = mysql_query($query2);
$num=mysql_numrows($result);
mysql_close();
$i=0;
$mailstring = "mailto: ";
while ($i < $num) {
$first=mysql_result($result,$i,"email_addresses_email_address");
$mailstring.= "$first; ";
$i++;
}
echo $mailstring;
?> Change your username and add a password if needed.
Obviously backup any files before you modify them, and I take no responsibility if anything gets broken while attempting to do this.
Any changes that would make this better please let me know. Also a bug I have found is that if you check items on one tab and move to another, the addresses from the first page will not be entered.
Bookmarks