2012-01-18 20 views
0

従来のASP/VBScriptでは、デフォルトのメールクライアントの新しいウィンドウを起動することが可能かどうかだけは疑問です。VBScript既定のメールウィンドウを起動する

私は次のことを試してみました:

set objOutlk = createobject("Outlook.Application") 
set objMail = objOutlk.createitem(olMailItem) 

をしかし、エラーが、何も得なかっ:Outlook.Application:ActiveXがオブジェクトを作成することはできません。

アドバイスをいただければ幸いです。

Rob。

+0

クライアントマシンまたはASP-Classicサーバー側スクリプトでVBScriptを実行しようとしていますか? – Filburt

+0

申し訳ありませんが、ASPサーバー側です。しかし、必要ならクライアント側でこれを行うことができますか? – rmccallum

+0

クライアントマシン上のメールウィンドウを開いてデータをあらかじめ入力しておき、クライアントがメールを送信して交換を行うようにする必要があります。 – rmccallum

答えて

0

あなたは(ASP)を見ているユーザのデフォルトのメールクライアントのメッセージを開くための簡単な方法を提供したい場合はページだけmailto:ハイパーリンクを追加:

<a href="mailto:[email protected]?subject=Hello%20World&body=Hi%20there">Send Msg</a> 

mailto:を開くためにブラウザをトリガーしますデフォルト(または設定済み)のメールクライアント。

あなたは、件名とメール本文を定義するクエリ文字列を追加することができます - 私の例では対象が「Hello World」ので、本文は「こんにちは」あります。

お知らせブランクは、それは、このクライアント側を実行することは意味をなさURLエンコード少し考えた後

+0

乾杯。私もこれを試してみることができますが、私はあなたがJSに何か間違って見ることができない限り、私は以下の答えが私の後ろであると思いますか? – rmccallum

+0

また、ユーザーからメールを送信するためにいくつかのデータを収集する必要がある場合は、JSを使用してリンクを構築する方法があります - 基本的に私の静的な例と同様の 'href'値で終わります。 – Filburt

0

%20に(プロンプトの皆さんのいくつかのおかげで)であり、私は次のJScriptを使用:

<script type="text/javascript"> 

function send() { 
alert("clicked") 
    var recpt = "[email protected]" 
    var subj = "FASTER BETTER SOONER: Look at Monash Rowville rail now" 
    var text = "<Enter your name and address here> %0D%0DMelbourne is growing and more people need transport. With concern about climate change and rising petrol prices, Melbourne's growth is not sustainable without more and better public transport.%0D%0DVictorians want more people catching public transport, cycling and walking; fewer trucks on our roads, more freight on rail; and fewer kilometres travelled by car and truck.%0D%0DPublic transport should: be fast, frequent, reliable, affordable and safe; grow as Melbourne grows; be available to all Melbournians; and be managed as an integrated, co-ordinated network.%0D%0DThis means bringing forward existing public transport projects, committing to new projects and accelerating programs to move freight off our roads and onto rail.%0D%0DIt also means looking very closely at the impact on greenhouse gas emissions of any new transport projects like tunnels and freeways.%0D%0DWe especially urge you to look at a feasibility study for a Monash Rowville rail line. %0D%0DAs Melbourne's population grows, better public transport will both reduce traffic congestion and provide a much needed antidote to spiralling petrol prices. " 
    var bcc = "[email protected]" 
    var content = new Array() 

    content[0] = "mailto:" 
    content[1] = recpt 
    content[2] = "?subject=" 
    content[3] = subj 
    content[4] = "&body=" 
    content[5] = text 
    content[6] = "&bcc=" 
    content[7] = bcc 
    content = content.join("") 
    window.location = content 
} 

これは、私が期待される結果には思えます。

Rob

関連する問題