ODBC Driver for Gmail

Build 23.0.8839

MailMessages

Create, update, delete, and query Gmail messages.

NOTE:このスキーマはすべてのテーブルに定義されます。すべてのテーブル名はサーバーのメールボックスフォルダです。

NOTE:E メールが特殊文字を含む場合には、メッセージボディ内の本文はbase64 でエンコードされます。デコードされたメッセージを取得するには、メッセージボディの本文をデコードするか、GetPart ストアドプロシージャを使用します。

テーブル固有の情報

このテーブルに含まれるE メールアドレスフィールドは、次のフォーマットを受け付けます:

  • 'Friendly Name' <address@company.com>
  • address@company.com
デフォルトのGmail テーブル名はバックスラッシュを含み、いくつかはスペースを含みます。デフォルトのGmail フォルダのテーブル名をエスケープするには、角かっこを使うことができます。次に例を示します。
SELECT * FROM [Gmail/All Mail]

Select

このテーブルへのクエリ結果は、以下のデフォルトに従います。
  • MessageBody およびHeaders フィールドは、複数のメッセージをリストする場合には返されません。
  • 返されるメッセージのデフォルト数は100です。これは、LIMIT もしくはMaxItems を使用して変更できます。メールボックス内のすべてのE メールを返したい場合には、0もしくは-1を設定してください。

メッセージをリスト

特定のメールボックス内のメッセージをリストするには、メールボックスをテーブルとして指定します。E メールは、新しいものから古いものの順でリストされます。別の方法として、メッセージID の範囲を指定することができます。範囲で使用可能なフォーマットは以下のとおりです。

  • ID が10のメッセージのみを返す:
    SELECT * FROM [Inbox] WHERE Id = 10 
  • 10から20までのすべてのメッセージを返す:
    SELECT * FROM [Inbox] WHERE Id BETWEEN 10 AND 20
  • 1、3、5のメッセージを返す:
    SELECT * FROM [Inbox] WHERE Id IN (1, 3, 5)

検索条件の適用

本製品 はE メールを検索する方法をいくつか提供します。下記のソースの検索条件を、SELECT クエリのWHERE 句で使用できます。

  • メッセージフィールド:E メールを検索するには、SELECT クエリのWHERE 句で以下のいずれかのカラムの値を指定します:To、From、BCC、CC、Subject、MessageBody、Flags、Labels、Size、またはDate。 括弧でネストされた、複雑なステートメントもサポートされています。

    To、From、BCC、CC、Subject、およびMessageBody は、次の演算子でフィルタ可能です:=、!=、CONTAINS。

    Flags とLabels は、= および!= 演算子のみをサポートします。

    Date は次の演算子でフィルタ可能です:=、<、<=、>、>=。

    Size は、< および> 演算子のみをサポートします。

    CONTAINS 関数には、UI の検索バーと同様に完全な単語(例えば、Tes ではなくTest)が必要であることに注意してください。 例えば、以下のクエリはtest1@email.com またはtest2@email.com のいずれかから、テキスト'Test' を含むすべてのメッセージを返します。

    SELECT * FROM [Gmail/All Mail] WHERE CONTAINS(MessageBody, "Test") AND ([From] = test1@email.com OR [From] = test2@email.com) AND Date > '1-1-2012'

  • 添付ファイル:標準カラムでの検索に加えて、添付ファイル名での検索および添付ファイルがあるかどうかでのフィルタも可能です。
    SELECT * FROM [Gmail/All Mail] WHERE HasAttachment = 'True' AND Attachments = '.txt'
  • Gmail-specific:ThreadId およびMsgId を使用して、= および!= 演算子でフィルタリングできます。また、IN 演算子もMsgId カラムに使用できます(演算子は内部的に= 演算子を使用して複数のステートメントに変換されます)。
  • IMAP:上記の検索条件の作成方法に代わる方法として、SearchCriteria 疑似カラムを使用して、RFC で指定されている有効なIMAP 検索条件を使って検索することができます。

Insert

Insert ステートメントはE メールの送信に使用します。Subject、To、およびMessageBody フィールドは必須です。

INSERT INTO [Gmail/All Mail] (Subject, MessageBody, To) VALUES ('Test Subject', 'Body Text', 'address@company.com')

Update

  • E メールをあるメールボックスから他のメールボックスに移動させる場合、UPDATE でメールボックスを指定します。
    UPDATE [Inbox] SET Mailbox = 'NewMailboxName' WHERE Id = 'MessageId'
    ID はメッセージ番号、':' で区切られた2つのメッセージ番号の範囲(例えば、"1:5")、または',' で区切られた個別のメッセージ番号(例えば、"1:5,7,10")を含むことができます。
  • E メールをあるメールボックスから他のメールボックスに移動させる場合、追加の更新を同時に指定することはできません。
  • フラグを更新するには、フラグを1つもしくはリストでUPDATE に指定します。
    UPDATE [Inbox] SET Flags = 'Seen' WHERE Id = 'MessageId'

    IMAP RFC で指定されているフラグの標準値は次のとおりです:'Answered'、'Flagged'、'Deleted'、'Seen'、および'Draft'。

    クエリで指定されたフラグは、すべてのE メールの現在のフラグをオーバーライドします。

Delete

IMAP を使用してGmail からメッセージを削除する場合、メッセージはサーバーからは削除されません。Gmail は現在の受信トレイのラベルを削除して、E メールを"archived" としてマークします。 すべてのフォルダからメッセージを永久に削除したい場合には:

  1. [Gmail]/ゴミ箱 へメッセージを移動してください。
  2. [Gmail]/ゴミ箱 フォルダからメッセージを削除してください。

Id フィールドが必要です。

DELETE FROM [Inbox] WHERE Id = '2'

補足

  • デフォルトで返されるメッセージの最大数は100 です。これは、LIMIT もしくはMaxItems を使用して変更できます。メールボックスのすべてのE メールを返したい場合には、0もしくは-1を設定してください。
  • デフォルトで返されるページごとのメッセージ数は25です。ItemsPerPage 疑似カラムを設定することで変更が可能です。
  • 返されるすべてのメッセージID はテンポラリID であり、続くサーバーへのリクエストで変わることがあります。

Columns

Name Type ReadOnly References Description
Id [KEY] String True

The identifier of the mail message.

Mailbox String False

The current mailbox that the item is listed in. Updating this value moves the message to a new mailbox.

Subject String False

The subject of the current message.

FullFrom String True

The sender name and email address of the current message.

From String True

The sender email address of the current message.

FullTo String True

A semicolon-separated list of names and email addresses of the recipients.

To String False

A semicolon-separated list of the email addresses of the recipients.

FullCC String True

A semicolon-separated list of names and email addresses of the CC'd recipients.

CC String False

A semicolon-separated list of the email addresses of the CC'd recipients.

FullBCC String True

A semicolon-separated list of the names and email addresses of the BCC'd recipients. This field is only applicable for sent mail.

BCC String False

A semicolon-separated list of the email addresses of the BCC'd recipients. This field is only applicable for sent mail.

Date Datetime True

The date and time the current message was sent.

MessageBody String False

The message body. This field can only be set if you specify a single Id in SELECT.

Attachments String False

A semicolon-separated list of the attachment file names (with the path specified if reading from a file) included in the message.

AttachmentData String False

A semicolon-separated list of the base-64-encoded attachment data included in the message. The file name in the Attachments field must also be specified to use this field.

Size Int True

The size in bytes of the current message.

Flags String False

The flags set on the current message.

Labels String False

The labels of the message, separated by spaces. Gmail treats labels as mailboxes.

ThreadId String True

The Gmail thread Id associated with the current message. Several messages may have the same thread Id.

MsgId String True

The Gmail message Id associated with the current message. This is a globally unique Id assigned by Google separate from the IMAP Id/UID.

PartIds String True

The Id of the message part.

PartFilenames String True

The file name of the message part.

PartContentTypes String True

The content type of the message part.

PartSizes String True

The size of the message part.

Headers String True

The message headers for the specified mail message. This field is only available if you specify a single Id in SELECT or set IncludeMessage connection property to true.

AttachmentHeaders String True

The attachment headers for the specified mail message. This field is only available if you specify a single Id in SELECT or set IncludeMessage connection property to true.

ContentIds String True

The content id headers for the specified mail message. This field is only available if you specify a single Id in SELECT or set IncludeMessage connection property to true.

Pseudo-Columns

SELECT ステートメントのWHERE 句では、疑似カラムフィールドを使用して、データソースから返されるタプルを詳細に制御することができます。

Name Type Description
SearchCriteria String

The search criteria to use for the search operation (i.e., SENTSINCE dd-MMM-yyyy). The IMAP RFCs specifies the exact format of the search criteria. The string consists of one or more search keys and their corresponding values, if any, separated by spaces. For example: 'SINCE 1-Feb-1994 NOT FROM Smith'.

ItemsPerPage String

The maximum number of items to return per page.

デフォルト値は25です。

IsHTML String

This field sets whether the email has an HTML or plain-text encoding.

デフォルト値はTRUEです。

Importance String

The importance of the mail message.

使用できる値は次のとおりです。UNSPECIFIED, LOW, NORMAL, HIGH

デフォルト値はUNSPECIFIEDです。

Priority String

The priority of the mail message.

使用できる値は次のとおりです。UNSPECIFIED, NONURGENT, URGENT, NORMAL

デフォルト値はUNSPECIFIEDです。

Sensitivity String

The sensitivity of the mail message.

使用できる値は次のとおりです。UNSPECIFIED, PERSONAL, PRIVATE, COMPANYCONFIDENTIAL

デフォルト値はUNSPECIFIEDです。

DeliveryNotification String

The email address to send a delivery notification to.

ReadReceipt String

The email address to send a read receipt to.

ShowLabels String

This field sets whether to show labels or not.

デフォルト値はTRUEです。

ShowThreadId String

This field sets whether to show the thread Id or not.

デフォルト値はTRUEです。

ShowMsgId String

This field sets whether to show the unique Gmail Id or not.

デフォルト値はTRUEです。

UIDMode String

If this value is set to true, permanent message Ids are used instead of the default temporary Ids.

デフォルト値はFALSEです。

HasAttachments String

If this value is set to true, only messages with attachments are listed. If false, all messages are listed.

DownloadAttachments String

If true, attachments are downloaded with the messages. Available only when specifying a single message Id or the Include Messages connection property is true. By default organizes attachments in subfolders with the message Id as name.

デフォルト値はFALSEです。

AttachmentFolder String

The folder that is used for downloading attachments. If this is set, the AttachmentData column does not return any data (that is, returns null) and the attachments are instead be written to disk. NOTE: An error is thrown if filters that cannot be supported server-side are included in the criteria. Please refer to the 'Apply Search Criteria' section for a list of supported filters.

EMLFolder String

The folder where the complete MIME message, which is saved as an EML file, is downloaded to. If multiple messages are selected, subfolders are created for each message.

Overwrite String

This field sets whether to overwrite attachments and EML files.

デフォルト値はFALSEです。

IncludeMessage String

This field sets whether to include the message content in the response.

デフォルト値はFALSEです。

Copyright (c) 2024 CData Software, Inc. - All rights reserved.
Build 23.0.8839