出于某种原因,“收件人”参数在我的 Mac 上的 Gmail 和 Outlook 中运行。但是当我在 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: </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: </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>