Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8748263
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T12:29:41+00:00 2026-06-13T12:29:41+00:00

I have been looking for this functionality, if is it possible to add an

  • 0

I have been looking for this functionality, if is it possible to add an email client selector when the users click on mailto: For example i am using following code for emails

<a href="mailto:email@me.com">Email Us</a>

What if users want to use gmail/yahoo/hotmail instead of his default email client e.g Outlook.
I have found a similar question asked before as well. But i need to know if that is in any case possible either with any jQuery plugin or HTML whatever it may be.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T12:29:43+00:00Added an answer on June 13, 2026 at 12:29 pm

    you can’t do this with ‘mailto’ functionality. But you can acheive targeting email clients with the help of php function.
    Here is the php function to Targeting Specific Web-based Clients:

        Targeting Specific Web-based Clients
    
    function wcs_mailto_ex($mailto='', $subject='', $body='', $client='', $link_text='', $link_title='', $at_replace='&#64;')
    {
    // 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 . '&amp;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 . '&amp;su=' . $subject . '&amp;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&amp;to=' . $mailto . '&amp;subject=' . $subject . '&amp;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) . '&amp;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;
    }
    

    To target gmail client call the above function as follows:

        wcs_mailto_ex('AnEmailAccount@gmail.com',
                'Test Subject Line',
                'This is a sample\n\nemail for testing.\n\nBest regards,\nme',
                'gmail',
                'gMail Client'
                );
    

    Source: http://wpcodesnippets.info/blog/how-to-target-mailto-email-clients.html

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been looking at this for to long so I am tossing it
I have been looking over this code for the past hour, I cant see
I have been looking all over for this. I have two seperate prpt files
I have been looking for an answer to this on Stack Overflow, but I
I have been looking for some time for this and I can't seem to
I have been looking for an answer to this and could not find it
I have been looking at the answer to this question: Pulling details from response
I have been looking around the web for this but cannot really find a
I have been looking everywhere but could not find a tutorial for this. I
I have been looking over the internet for a while about this, but it

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.