2017-01-29 32 views
1

我有HTML上的社交分享按鈕列表。點擊其中的每一個都可以發送圖像(請參閱codepen示例)。我想知道是否有辦法在郵件正文上的「通過郵件發送」按鈕上附加相同的圖像。如何在點擊「通過郵件發送」按鈕時在郵件正文中嵌入圖片

感謝

codepen sample

.FCBK, .TWITTER, .GPLUS, .MAIL { 
 
position: absolute; 
 
display:block; 
 
top:0; 
 
right:0; 
 
margin-top:5px; 
 
text-indent:-9999px; 
 
width:50px; 
 
height:50px; 
 
background-repeat:no-repeat; 
 
cursor: pointer; 
 

 
} 
 
.FCBK { 
 
background-image: url(http://www.myrtlebeachgolf.com/assets/images/facebook-icon.png); 
 
margin-right: 203px; 
 
} 
 
.TWITTER { 
 
background-image: url(http://www.myrtlebeachgolf.com/assets/images/twitter-icon.png); 
 
margin-right:141px; 
 
} 
 

 
.GPLUS { 
 
background-image: url(http://www.myrtlebeachgolf.com/assets/images/google-plus-icon.png); 
 
margin-right:79px; 
 
} 
 

 
.MAIL { 
 
background-image: url(http://www.myrtlebeachgolf.com/assets/images/email-icon.png); 
 
margin-right:17px; 
 
} \t
<div class="SOCIAL"> 
 
<a class="FCBK" rel="img_src" href="" 
 

 
    onclick="popUp=window.open(
 
     'https://www.facebook.com/sharer.php?u=http://www.designboom.com/contest/files/copy_0_brain1.jpg', 
 
     'popupwindow', 
 
     'scrollbars=yes,width=800,height=400'); 
 
    popUp.focus(); 
 
    return false" title="Share on Facebook"> 
 
    <!--<i class="visuallyhidden">share on facebook</i>--> 
 
</a> 
 

 
<a class="TWITTER" rel="nofollow" 
 
    href="https://twitter.com/" 
 
    onclick="popUp=window.open(
 
     'https://twitter.com/intent/tweet?text=pic.twitter.com/HntZUf55tt', 
 
     'popupwindow', 
 
     'scrollbars=yes,width=800,height=400'); 
 
    popUp.focus(); 
 
    return false" title="Share on Twitter"> 
 
    <!-- <i class="visuallyhidden">share on twitter</i>--> 
 
</a> 
 

 
<a class="GPLUS" rel="nofollow" 
 
    href="https://www.plus.google.com/" 
 
    onclick="popUp=window.open(
 
     'https://plus.google.com/share?url=http://www.designboom.com/contest/files/copy_0_brain1.jpg', 
 
     'popupwindow', 
 
     'scrollbars=yes,width=800,height=400'); 
 
    popUp.focus(); 
 
    return false" title="Share on Google+"> 
 
    <!--<i class="visuallyhidden">share on google plus</i>--> 
 
</a> 
 
<a class="MAIL" rel="nofollow" 
 
    href="mailto:?subject=I like this &body=http://www.designboom.com/contest/files/copy_0_brain1.jpg" title="Send by mail"> 
 
    <!--<i class="visuallyhidden">share via email</i>--> 
 
</a> 
 
</div>

回答

0

據我所知實現這一目標的唯一方法是使用Base64編碼的圖像。看到這個答案:

Sending mail from HTML page with image in the body

請記住,您不能使用空格作爲字符。電子郵件內容必須由實體編碼。否則某些字符會破壞你的代碼。只需使用%20而不是空格。對於進一步的編碼實驗,你可以試試This online encoder

+0

謝謝,我來看看。 – Danielillo

+0

據我所知不可能:-( – Danielillo

+0

@Danielillo請記住,你不能使用空格作爲字符,這會打破代碼,只需使用「%20」而不是空格;) – Hexodus

相關問題