UiPath Documentation
activities
latest
false
生産性を高めるアクティビティ
重要 :
このコンテンツの一部は機械翻訳によって処理されており、完全な翻訳を保証するものではありません。 新しいコンテンツの翻訳は、およそ 1 ~ 2 週間で公開されます。

メールをローカルで作成し保存する

添付ファイル付きの Outlook メールを作成して保存します。

以下の例では、添付ファイル付きの Outlook メールを作成して保存する方法を説明します。[メール メッセージを保存] や [添付ファイルを保存] などのアクティビティを示します。これらのアクティビティは、UiPath.Mail.Activities パッケージに含まれています。

サンプルと同等のオートメーション プロセスは以下のように構築できます。

  1. Studio を開いて、新しいプロセスを作成します。

  2. デザイナー パネルに [シーケンス] コンテナーをドラッグします。

    • 次の変数を作成します。

      変数名変数の型既定値
      mailMessageSystem.Collections.Generic.List<System.Net.Mail.MailMessage>
  3. [シーケンス] コンテナー内に [コードを呼び出し] アクティビティをドラッグします。

    • [ コードを編集 ] ボタンを選択し、次のコードを追加します。

      "'Create a message and set up the recipients.
      Dim sender As String = "sender@outlook.com"
      Dim receiver As String = "receiver@outlook.com"
      Dim subject As String = "Project plan"
      Dim body As String = "See the attached document."
      message = New MailMessage(sender, receiver, subject, body)
      'Create the file attachment for this email message.
      Dim data As Attachment = New Attachment("Input\Project-plan.xlsx")
      'Add the file attachment to the email message.
      message.Attachments.Add(data)"
      "'Create a message and set up the recipients.
      Dim sender As String = "sender@outlook.com"
      Dim receiver As String = "receiver@outlook.com"
      Dim subject As String = "Project plan"
      Dim body As String = "See the attached document."
      message = New MailMessage(sender, receiver, subject, body)
      'Create the file attachment for this email message.
      Dim data As Attachment = New Attachment("Input\Project-plan.xlsx")
      'Add the file attachment to the email message.
      message.Attachments.Add(data)"
      
    • [ 引数を編集 ] ボタンを選択し、「 message」という名前の新しい引数を作成します。[ 方向] は [ Out] に、[ 型 ] は [ MailMessage] に、[ 値 ] は [ mailMessage] に設定します。

    注:

    必ず sender@outlook.com と receiver@outlook.com のメール アドレスを望ましいメール アドレスに置き換えてください。 添付のプロジェクトでは、さまざまなメール アカウントが使用されています。

  4. [コードを呼び出し] アクティビティの下に [メール メッセージを保存] アクティビティをドラッグします。

    • [メール メッセージ] フィールドに変数 mailMessage を追加します。
    • 式 "Output\email.eml" を [ファイル パス] フィールドに追加します。
  5. [添付ファイルを保存] アクティビティを、[メール メッセージを保存] アクティビティの下にドラッグします。

    • [メール メッセージ] フィールドに変数 mailMessage を追加します。
    • 式 "Output\Attachments" を [フォルダー パス] フィールドに追加します。
    • ワークフローは次のようになります。

  6. プロセスを実行します。メールは、設定した送信者と受信者を使用して、ファイルを添付した状態で作成されます。その後、メールと添付ファイルは指定されたフォルダーに保存されます。

    注:

    プロジェクトの zip ファイルの出力フォルダーには既に添付ファイルが含まれています。フォルダーは空である必要があります。

このページは役に立ちましたか?

接続

ヘルプ リソース サポート(opens in new window)

学習する UiPath アカデミー(opens in new window)

質問する UiPath フォーラム(opens in new window)

最新情報を取得