「mailto」機能でこれを行うことはできません。しかし、php 関数の助けを借りて、電子メール クライアントをターゲットにすることができます。特定の Web ベースのクライアントをターゲットにするための php 関数を次に示します。
Targeting Specific Web-based Clients
function wcs_mailto_ex($mailto='', $subject='', $body='', $client='', $link_text='', $link_title='', $at_replace='@')
{
// init
$subject = rawurlencode(strip_tags($subject));
$body = str_replace('\r\n', '%0A', $body);
$body = str_replace('\n', '%0A', $body);
if (!$link_text) {$link_text = $mailto;}
$link_text = str_replace('@', $at_replace, $link_text);
$client = strtolower($client);
// default parameters (system mail: Outlook, Thunderbird, etc.)
$email['url'] = 'mailto:' . $mailto . '?subject=' . $subject . '&body=' . $body;
$email['width'] = 0;
$email['height'] = 0;
$email['scrollbars'] = 0;
// constuct client-specific parameters
switch($client)
{
case 'gmail':
case 'g mail':
case 'google mail':
case 'google':
$email['url'] = 'https://mail.google.com/mail/?view=cm&fs=1&tf=1&source=mailto&shva=1&to=' . $mailto . '&su=' . $subject . '&body=' . $body;
$email['width'] = 700;
$email['height'] = 500;
$email['scrollbars'] = 1;
break;
case 'hotmail':
case 'hmail':
case 'livemail':
case 'live mail':
$email['url'] = 'http://mail.live.com/?rru=compose&to=' . $mailto . '&subject=' . $subject . '&body=' . $body;
$email['width'] = 850;
$email['height'] = 550;
$email['scrollbars'] = 1;
break;
case 'yahoo mail':
case 'ymail':
case 'yahoo':
$body = str_replace('%0A', '<br>', $body);
$body = urlencode(urlencode($body));
$email['url'] = 'http://compose.mail.yahoo.com?to=' . $mailto . '&subject=' . rawurlencode($subject) . '&body=' . $body;
$email['width'] = 750;
$email['height'] = 625;
$email['scrollbars'] = 1;
break;
}
// prep for popup
$wdw_name = 'wcs_mailto_ex_wdw';
$wdw_features = "scrollbars=$scrollbars,status=0,toolbar=0,location=0,directories=0,menubar=0,resizable=1,width=";
$url = $email['url'];
$width = $email['width'];
$height = $email['height'];
$scrollbars = $email['scrollbars'];
// determine if display should be a popup window
if ($email['width'])
{
$javascript = "window.open('$url', '$wdw_name', '$wdw_features$width,height=$height');return false;";
$output = "<a rel='nofollow' style='cursor:pointer;' onclick=\"$javascript\" title='$title'>" . $link_text . "</a>";
}
else
{
$output = '<a href="' . $url . '" rel="nofollow" title="' . $link_title . '">' . $link_text . '</a>';
}
// exit
echo $output;
}
Gmail クライアントをターゲットにするには、上記の関数を次のように呼び出します。
wcs_mailto_ex('AnEmailAccount@gmail.com',
'Test Subject Line',
'This is a sample\n\nemail for testing.\n\nBest regards,\nme',
'gmail',
'gMail Client'
);
ソース: http://wpcodesnippets.info/blog/how-to-target-mailto-email-clients.html