SmtpMailとは? わかりやすく解説

SmtpMail クラス

メモ : このクラスは、互換性のために残されています。

CDOSYS (Collaboration Data Objects for Windows 2000) メッセージ コンポーネント使用してメッセージ送信するための、プロパティメソッド提供します推奨する代替 : System.Net.Mail

名前空間: System.Web.Mail
アセンブリ: System.Web (system.web.dll 内)
構文構文

<ObsoleteAttribute("The recommended alternative is System.Net.Mail.SmtpClient.
 http://go.microsoft.com/fwlink/?linkid=14202")> _
Public Class SmtpMail
[ObsoleteAttribute("The recommended alternative is System.Net.Mail.SmtpClient.
 http://go.microsoft.com/fwlink/?linkid=14202")] 
public class SmtpMail
[ObsoleteAttribute(L"The recommended alternative is System.Net.Mail.SmtpClient.
 http://go.microsoft.com/fwlink/?linkid=14202")] 
public ref class SmtpMail
/** @attribute ObsoleteAttribute("The recommended alternative is System.Net.Mail.SmtpClient.
 http://go.microsoft.com/fwlink/?linkid=14202") */ 
public class SmtpMail
ObsoleteAttribute("The recommended alternative is System.Net.Mail.SmtpClient.
 http://go.microsoft.com/fwlink/?linkid=14202") 
public class SmtpMail
解説解説
使用例使用例

次の例をコンパイルすると、コマンド ラインから電子メール送信できるコンソール アプリケーション作成できます。この例のコードを MailMessage.exe という名前のファイルコンパイルした場合は、次のように実行可能ファイル使用して電子メール送信できます

MailMessage to@contoso.com from@contoso.com test hello
Imports System
Imports System.Web.Mail
 
Namespace SendMail
   Public Class usage
      Public Sub DisplayUsage()
         ' Display usage instructions in case of error.
         Console.WriteLine("Usage SendMail.exe <to> <from>
 <subject> <body>")
         Console.WriteLine("<to> the addresses of the email
 recipients")
         Console.WriteLine("<from> your email address")
         Console.WriteLine("<subject> subject of your email")
         Console.WriteLine("<body> the text of the email")
         Console.WriteLine("Example:")
         Console.WriteLine("SendMail.exe SomeOne@contoso.com;SomeOther@contoso.com
 Me@contoso.com Hi hello")
     End Sub
   End Class

   Public Class Start
      '  The main entry point for the application.
      Public Shared Sub
 Main(ByVal args As String())
         Try
            Try
               Dim Message As System.Web.Mail.MailMessage
 = New System.Web.Mail.MailMessage()
               Message.To = args(0)
               Message.From = args(1)
               Message.Subject = args(2)
               Message.Body = args(3)
               Try
                  SmtpMail.SmtpServer = "your mail server name
 goes here"
                  SmtpMail.Send(Message)
               Catch ehttp As System.Web.HttpException
                  Console.WriteLine("0", ehttp.Message)
                  Console.WriteLine("Here is the full error message")
                  Console.Write("0", ehttp.ToString())
               End Try
            Catch e As IndexOutOfRangeException
               ' Display usage instructions if error in arguments.
               Dim use As usage = New
 usage()
               use.DisplayUsage()
            End Try
         Catch e As System.Exception
            ' Display text of unknown error.
            Console.WriteLine("Unknown Exception occurred 0",
 e.Message)
            Console.WriteLine("Here is the Full Error Message")
            Console.WriteLine("0", e.ToString())
         End Try
      End Sub
   End Class
End Namespace
using System;
using System.Web.Mail;
 
namespace SendMail
{
   class usage
   {
      public void DisplayUsage()
      {
         Console.WriteLine("Usage SendMail.exe <to> <from> <subject>
 <body>");
         Console.WriteLine("<to> the addresses of the email recipients");
         Console.WriteLine("<from> your email address");
         Console.WriteLine("<subject> subject of your email");
         Console.WriteLine("<body> the text of the email");
         Console.WriteLine("Example:");
         Console.WriteLine("SendMail.exe SomeOne@Contoso.com;SomeOther@Contoso.com
 Me@contoso.com Hi hello");
      }
   }
 

   class Start
   {
      // The main entry point for the application.
      [STAThread]
      static void Main(string[]
 args)
      {
         try
         {
            try
            {
               MailMessage Message = new MailMessage();
               Message.To = args[0];
               Message.From = args[1];
               Message.Subject = args[2];
               Message.Body = args[3];

               try
               {
                  SmtpMail.SmtpServer = "your mail server name goes here";
                  SmtpMail.Send(Message);
               }
               catch(System.Web.HttpException ehttp)
               {
                  Console.WriteLine("{0}", ehttp.Message);
                  Console.WriteLine("Here is the full error message output");
                  Console.Write("{0}", ehttp.ToString());
               }
            }
            catch(IndexOutOfRangeException)
            {
               usage use = new usage();
               use.DisplayUsage();
            }
         }
         catch(System.Exception e)
         {
            Console.WriteLine("Unknown Exception occurred {0}", e.Message);
            Console.WriteLine("Here is the Full Message output");
            Console.WriteLine("{0}", e.ToString());
         }
      }
   }
}
import System.*;
import System.Web.Mail.*;
class Usage
{
    public void DisplayUsage()
    {
        Console.WriteLine("Usage SendMail.exe <to> <from> <subject>
 <body>");
        Console.WriteLine("<to> the addresses of the email recipients");
        Console.WriteLine("<from> your email address");
        Console.WriteLine("<subject> subject of your email");
        Console.WriteLine("<body> the text of the email");
        Console.WriteLine("Example:");
        Console.WriteLine("SendMail.exe SomeOne@Contoso.com;" 
            + "SomeOther@Contoso.com Me@contoso.com Hi hello");
    } //DisplayUsage
} //Usage

class Start
{
    // The main entry point for the application.
    /** @attribute STAThread()
     */
    public static void main(String[]
 args)
    {
        try {
            try {
                MailMessage message = new MailMessage();
                message.set_To(args[0]);
                message.set_From(args[1]);
                message.set_Subject(args[2]);
                message.set_Body(args[3]);

                try {
                    SmtpMail.set_SmtpServer("your mail server name goes here");
                    SmtpMail.Send(message);
                }
                catch (System.Web.HttpException eHttp) {
                    Console.WriteLine("{0}", eHttp.get_Message());
                    Console.WriteLine("Here is the full error message output");
                    Console.Write("{0}", eHttp.ToString());
                }
            }
            catch (IndexOutOfRangeException exp) {
                Usage use = new Usage();
                use.DisplayUsage();
            }
        }
        catch (System.Exception e) {
            Console.WriteLine("Unknown Exception occurred {0}", e.get_Message());
            Console.WriteLine("Here is the Full Message output");
            Console.WriteLine("{0}", e.ToString());
        }
    } //main
} //Start()
継承階層継承階層
System.Object
  System.Web.Mail.SmtpMail
スレッド セーフスレッド セーフ
この型の public static (Visual Basic では Shared) メンバはすべて、スレッド セーフです。インスタンス メンバ場合は、スレッド セーフであるとは限りません。
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
SmtpMail メンバ
System.Web.Mail 名前空間

SmtpMail プロパティ


SmtpMail メソッド


SmtpMail メンバ

CDOSYS (Collaboration Data Objects for Windows 2000) メッセージ コンポーネント使用してメッセージ送信するための、プロパティメソッド提供します推奨する代替 : System.Net.Mail

SmtpMail データ型公開されるメンバを以下の表に示します


パブリック プロパティパブリック プロパティ
パブリック メソッドパブリック メソッド
プロテクト メソッドプロテクト メソッド
参照参照

関連項目

SmtpMail クラス
System.Web.Mail 名前空間



英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

「SmtpMail」の関連用語

SmtpMailのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



SmtpMailのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2024 Microsoft.All rights reserved.

©2024 GRAS Group, Inc.RSS