0

何らかの理由で、「To」パラメータがGmailとOutlookのMacで機能しています。しかし、Windowsでリンクを試してみると、どのブラウザーでもどのクライアントでも機能しません。何が得られますか?

少し背景として、JavaScriptを使用してリンクを構築しています。以下は私のコードです。多分私はこれを間違ってやっています。これがWindowsでのみ問題になり、ブラウザやメールクライアントに依存しないのは奇妙なことです。

コード:

<div class="customsms-model-box email-modal share-modal sms-modal">
  <div class="modal-title">Send a link via SMS</div>
  <form id="email-box">
    <div class="email-info">
      Web access on phone is required to view the full list. Standard text message rates from your carrier will apply. You will be sending this SMS message through your e-mail program. We will build everything for you. You will just have to send it.
    </div>

    <div class="mobile-carrier">
      <span class="carrier-label">Mobile carrier:&nbsp;</span>
      <select name="email_to_email">
        <option value='' selected="selected">Select one</option>
        <?php print users_carrier_options(); ?>
      </select>
    </div>

    <div class="recipient-phone">
      <span class="recipients-phone">Recipient's phone:&nbsp;</span>
      <input type="text" name="phone_number" value="" /><br>
      <span class="subnote">Enter phone number including area code. Numbers only, no other characters.</span>
    </div>

    <div class="email-buttons">
      <a href="#" class="orange-link send-mail" target="_blank">Send link</a>
      <a href="#" class="simple-link cancel close">Cancel</a>
    </div>
  </form>
</div>

<div class="email_body" ref="<?php print $list->id; ?>">Follow the URL to see my items! <?php print $smsLink; ?></div>

<div class="email_subject" ref="<?php print $list->id; ?>">SOME COMPANY SUBJECT</div>

<script>
jQuery(document).ready(function($) {
  var eBody = $('#modal-content .email_body').text();
  var eSubject = $('#modal-content .email_subject').text();
  var eTo = "";
  var eFrom = "<?php print $user->mail; ?>";
  update_email();

  $('a.send-mail').click(function() {
    if (eTo == '') {
      alert("You must enter an email address!");
      return false;
    }
  });

  //Replace this with something for the SMS carrier emailTo stuff
  $(".mobile-carrier select").change(function(){
    if ($(this).val() != '') {
      update_to(true);
    }
  });

  $(".recipient-phone input").change(function(){
    if ($(this).val() != '') {
      update_to();
    }
  });

  function update_to(calledBySelect) {
    if (calledBySelect != true) {
      calledBySelect = false;
    }

    var phone = $(".recipient-phone input").val().replace(/[^\d.]/g, ""); //Get the phone number and leave only digits

    //A little validation
    if (phone.length != 10 && !calledBySelect) {
      alert('You must put in a 10 digit phone number.');
      return false;
    }

    var carrier = $('.mobile-carrier select').val();//Gotta load the carrier domain
    eTo = phone + '@' + carrier; //Build the email to address
    update_email(); //Make sure all of this gets updated
  }

  function update_email() {
    $('.email-buttons a.send-mail').attr( 'href', 'mailto:?subject=' + encodeURIComponent(eSubject) + '&body=' + encodeURIComponent(eBody) + '&to=' + encodeURIComponent(eTo) + '&from=' + encodeURIComponent(eFrom) );
  }
});
</script>
4

1 に答える 1

2

パラメータを設定する代わりにto、メールを最前面に設定します。

mailto:EMAIL_ADDRESS?Subject....

$('.email-buttons a.send-mail').attr( 'href', 'mailto:'+encodeURIComponent(eTo)+'?subject=' + encodeURIComponent(eSubject) + '&body=' + encodeURIComponent(eBody) + '&from=' + encodeURIComponent(eFrom) );
于 2013-03-22T18:31:03.513 に答える