以下為本站文章分類清單

  1. AJAXspacer
  2. ASPspacer
  3. CSSspacer
  4. Javascriptspacer
  5. Windows 應用程式spacer
  6. 網頁設計
  7. 評論、短文、雜文spacer
  8. 版主spacer
  9. 最新回應spacer

以下為本頁本文內容

CSS Gradientw3 JMail 使用例以及附件問題

9/7 12' icon

Photo by http://www.fulans.com

w3 Jmail 是一套功能強大,支援廣泛的元件,而且,免費版本功能一點都不陽春,基本使用例如下

JMail 範例(Classic ASP)
Set jMail=Server.CreateObject("JMail.Message")

jMail.logging=true

jMail.From=寄件人郵件
jMail.FromName=寄件人姓名

jMail.AddRecipient 收件人1
jMail.AddRecipient 收件人2

jMail.Charset="utf-8"	'郵件編碼格式
jMail.ContentType="text/html"	'郵件文件格式

jMail.AddAttachment(附件的絕對路徑,例如 c:\attach.zip)

jMail.Subject=郵件主旨
jMail.Body=郵件內容

jMail.Send(郵件主機)
jMail.Close()	

說明

注意行 1 ,此處建立的是 JMail.Message ,而不是 JMail.SMTPMail

再看行 19,指定 mail server,必要時,還要指定登錄的帳號及密碼(jMail.MailServerUserName / jMail.MailServerPassword) ,至於,自己沒有郵件主機怎麼辦?在台灣的朋友有一個 ISP 名稱叫"種花",他就有 mail server,好像叫 msa 點什麼什麼的。

如果你想用 Google Mail ,我自己的測試因為 port 問題無法執行,網路上有人使用 JMail.SMTPMail 可執行,請參考 http://vfp.sunyear.com.tw/viewtopic.php?p=26675(不過,問的人和回答的人似乎在雞同鴨講,發問者問 jMail,回答者似乎以 CDOMessage 在回答)

當不附加附件時,行 14 取消,郵件內容可以包含 HTML 標籤,如果要加入 CSS 設定,最好用行內型式,否則不保證收信人能看到你的設計。

而如果照上述範例,加入了附件後,收信者看起來像

This is a multipart message in MIME format. ----NEXT_BM_86C53B8AAFA14784B24AACCE9649C62E Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: Quoted-Printable NjYuMjIwLjE3LjI1DQoNCg0KDQrAy7X4sXq7UKa5s3O1uKRIqrqnub7jue+4 3LBPv/0NCg0KDQoNCg0KKiANCkF1ZGksIKRqu7asT6RAutipdL9Xqrqtuaqr ILuhOg0Kpv0sIKfawdmms6V0pECt07Ddw0QNCqfaqrqlRCBkbnMgPSBkbnMu cG9zdGVybWlzLmNvbQ0KprggZG5zID0gZG5zLmF1ZGl3YW5nLmNvbQ0KuOqu xqzbplANCrCys10sILjMrbGmsyB3d3cucmVjY2EudHcNCm5nbmduZyC7oToN Cqfapf2laKZZtrqhSafataWkQKRVp+St02Ruc6vYsWSr16q6wMvD0b65DQpB dWRpLCCkaru2rE+kQLrYqXS/V6q6rbmqqyC7oToNCqZuLCCn2qfisN3DRK9k tdssp0GmXqjTrN0NCrJ7pmIgd3d3LnJlY2NhLnR3IKq6IElQIK1up+8sIKfa pf2n76RGpUQgRE5TIKRXqrq46q7GLCC1sqpHLCCko7d8s3EuLi4uILCjq0Sn 2qfisMYgRE5TIKRdp++kRg0KprOkQKa4LCCn2rROq9yl1iwgqr2xtafvsMYg RE5TIKbTpHcNCrWyqkcsIE9LIKhTsN3DRA0KKiANCnJlY2NhMDEyMEBnbWFp bC5jb20gu6EgKDIwMTIvNC8yMCCkVaTIIDAxOjE5KToNCipvaw0KKrNvrdOw 3cNErE+zb7zLqroNCnJlY2NhMDEyMEBnbWFpbC5jb20gu6EgKDIwMTIvNC8y

這是因為附件以 inline 型式內嵌到 ContentType 設為 text/html 的結果,事實上,取消行 12 ContentType 設定即可。但是收信者可能看到

<html><head><head>      <meta http-equiv="Content-Type" content="text/html; charset=utf-8 ">    <meta http-equiv="Expires" content="Tue, 09 Dec 1997 00:00:00 GMT">     <meta name="Author" content="Audi">     <title></title></head><table width="100%" border="0" cellspacing="0" cellpadding="2">   <tr>            <td valign="top">                       <table width="100%"  border="0" cellspacing="0" cellpadding="2">                                <tr>                                    <td colspan="3">

也就是說,取消了 ContentType 設定,附件是正確附加到郵件中,但郵件內容也變成純文字,反之,設定了 ContentType 為 HTML 格式後,附件又變成以 html 方式解譯。

看起來很兩難,不過基於一個各項功能都很優秀的元件來說,這種情況一定可以解決,方式很簡單,把行 17 的 jMail.Body 改成 jMail.HTMLBody 並且取消 ContentType 設置即可。

 

以下為文章回應區

同意轉載,不過麻煩看一下轉載需知

What is the tendon at the back of your ankle?   2017/8/21 下午 07:48:00

Good day I am so happy I found your site,
I really found you by accident, while I was researching on Aol
for something else, Regardless I am here now and would just like to say thanks a lot for a marvelous post and a all round interesting blog (I also love the theme/design), I don't
have time to read through it all at the moment but I have bookmarked it and also
added your RSS feeds, so when I have time I will be back
to read much more, Please do keep up the great
work.

sylvialeichtenberge.hatenablog.com   2017/8/12 下午 04:16:00

Wow, that's what I was looking for, what a data!
present here at this webpage, thanks admin of this web page.

Do you get taller when you stretch?   2017/8/4 上午 09:18:00

Does your blog have a contact page? I'm having problems locating it but, I'd like to shoot
you an e-mail. I've got some suggestions for
your blog you might be interested in hearing.
Either way, great site and I look forward to seeing it expand over time.

How do you treat a sore Achilles tendon?   2017/7/31 上午 10:36:00

I am regular reader, how are you everybody? This post posted
at this web site is really good.

http://margieclubb.hatenablog.com   2017/7/31 上午 03:46:00

I love your blog.. very nice colors & theme. Did you make
this website yourself or did you hire someone to do it for you?
Plz answer back as I'm looking to create my own blog and would like
to find out where u got this from. thanks

What causes burning pain in Achilles tendon?   2017/7/28 上午 10:34:00

Hi i am kavin, its my first time to commenting anywhere,
when i read this piece of writing i thought i could also make comment due
to this sensible article.

Can you stretch to get taller?   2017/7/21 上午 11:56:00

Wonderful, what a web site it is! This web site provides useful information to us, keep it up.

foot pain causes   2017/7/4 上午 12:47:00

Sweet blog! I found it while surfing around on Yahoo News.
Do you have any suggestions on how to get listed in Yahoo News?
I've been trying for a while but I never seem to get there!

Thanks

foot pain from standing   2017/7/3 下午 08:18:00

These are in fact fantastic ideas in about blogging. You have touched some nice
things here. Any way keep up wrinting.

   2017/6/24 下午 07:09:00

I drop a leave a response whenever I like a article on a blog
or if I have something to valuable to contribute to the conversation.
Usually it's caused by the sincerness communicated in the post
I looked at. And on this post 【卜維丰】w3 JMail 使用例以及附件問題.
I was actually moved enough to create a thought
;) I do have 2 questions for you if you don't mind.

Could it be just me or do some of the responses look as if
they are coming from brain dead visitors? :-P And, if you are writing on additional social sites, I'd
like to follow anything fresh you have to post. Would you make a
list every one of your communal sites like your linkedin profile,
Facebook page or twitter feed?

   2017/6/16 下午 11:04:00

With havin so much content do you ever run into
any issues of plagorism or copyright infringement? My site has a
lot of completely unique content I've either created myself or
outsourced but it appears a lot of it is popping it up all over the
internet without my authorization. Do you know any techniques to help reduce content from being ripped off?
I'd definitely appreciate it.

astonishingdese4.snack.ws   2017/6/12 下午 02:08:00

Hello colleagues, its enormous paragraph about educationand completely
explained, keep it up all the time.

nosyquota199.sosblogs.com   2017/6/11 上午 05:21:00

I used to be recommended this blog by my cousin.
I'm no longer positive whether or not this submit is written by means
of him as nobody else understand such distinct about my difficulty.
You are wonderful! Thanks!

manicure   2017/5/4 上午 09:01:00

Great article.

manicure   2017/4/11 下午 06:17:00

I am really loving the theme/design of your weblog. Do you ever run into any web browser compatibility issues?
A couple of my blog audience have complained about my site
not operating correctly in Explorer but looks great in Chrome.
Do you have any recommendations to help fix this problem?

給個回應
姓名:
佈落格網址:
  如果您是要發問問題, 最好有個問題測試的網址, 這樣比較容易找到您問題所在, 謝謝
內容: