asp發送html郵件中加入圖片

來源:互聯網
上載者:User
這個木鳥以前實驗過,但沒成功,最後改成http串連圖片,看看你能成功不,成功了記得告訴大家

1 <HTML>  
2  
3 <body bgcolor=white>  
4  
5 <%  
6  
7 if request.ServerVariables("REQUEST_METHOD") = "GET" then  
8  
9 %>  
10  
11 <form action="htmlemail.asp" method=post>  
12 <font face=verdana>  
13 Your Name <input type="text" name="strName"> Your EMail <input type="text" name="strEmail">  
14 <br>  
15 Recipient Email <input type="text" name="strTo">  
16 <p>  
17  
18 <textarea cols=40 rows=4 name=message>Your message</textarea>  
19  
20 </p>  
21  
22 <input type=submit name=send value=Send>  
23  
24 </form>  
25  
26 <%  
27  
28 else  
29  
30 Set objMail = Server.CreateObject("CDONTS.NewMail")  
31 objMail.Importance = 1  
32 objMail.From = request("strName") & "<" & request("strEmail") & ">"  
33 objMail.To = request("strTo")  
34 objMail.Subject = "Example of HTML EMail with Embeded Image"  
35  
36 ' this is my messages HTML  
37 strMsg = "" & _  
38 "<html><body bgcolor=red>" & _  
39 "<a href="" 45 objMail.BodyFormat = 0  
46 objMail.MailFormat = 0  
47 objMail.Body = strMsg  
48  
49 ' attach our image file and Set the url to simply http://www.webjx.com/htmldata/2005-05-05/http://www.webjx.com/htmldata/2005-05-05/logo.gif  
50 objMail.AttachURL server.MapPath("http://www.webjx.com/htmldata/2005-05-05/http://www.webjx.com/htmldata/2005-05-05/logo.gif"), "http://www.webjx.com/htmldata/2005-05-05/http://www.webjx.com/htmldata/2005-05-05/logo.gif"  
51 objMail.Send  
52  
53 ' destroy the email object  
54 Set objMail = Nothing  
55  
56 %>  
57 <h1>  
58 <font face=verdana>Message Sent, Thanks!</font>  
59 </h1>  
60  
61 <% end if %>

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.