MailAttachment コンストラクタ (String)
アセンブリ: System.Web (system.web.dll 内)



'This example shows how to programmatically add attachments 'to a mail lessage. Dim MyMail As MailMessage = New MailMessage() Dim iLoop1 As integer ' Concatenate a list of attachment files in a string. Dim sAttach As String = "C:\images\image1.jpg,C:\images\image2.jpg,C:\images\image3.jpg" ' Build an IList of mail attachments using the files named in the string. Dim delim As Char = " ," Dim sSubstr As String For Each sSubstr in sAttach.Split(delim) Dim myAttachment As MailAttachment = New MailAttachment(sSubstr) myMail.Attachments.Add(myAttachment) Next
//This example shows how to programmatically add attached files //to a mail lessage. MailMessage myMail = new MailMessage(); // Concatenate a list of attachment files in a string. string sAttach = @"C:\images\image1.jpg,C:\images\image2.jpg ,C:\images\image3.jpg"; // Build an IList of mail attachments using the files named in the string. char[] delim = new char[] {','}; foreach (string sSubstr in sAttach.Split(delim)) { MailAttachment myAttachment = new MailAttachment(sSubstr); myMail.Attachments.Add(myAttachment); }
//This example shows how to programmatically add attached files //to a mail lessage. MailMessage myMail = new MailMessage(); // Concatenate a list of attachment files in a string. String sAttach = "C:\\images\\image1.jpg,C:\\images\\image2.jpg," + "C:\\images\\image3.jpg"; // Build an IList of mail attachments using the files named // in the string. char delim[] = new char[] { ',' }; for (int iCtr = 0; iCtr < sAttach.Split(delim).get_Length(); iCtr++) { String sSubstr = sAttach.Split(delim)[iCtr]; MailAttachment myAttachment = new MailAttachment(sSubstr); myMail.get_Attachments().Add(myAttachment); }

Windows 98, Windows 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


MailAttachment コンストラクタ

名前 | 説明 |
---|---|
MailAttachment (String) | 添付ファイルの名前を指定して、MailAttachment クラスの新しいインスタンスを初期化します。既定では、Encoding プロパティは UUEncode に設定されます。推奨する代替 : System.Net.Mail. |
MailAttachment (String, MailEncoding) | 添付ファイルの名前とエンコーディングの種類を指定して、MailAttachment クラスの新しいインスタンスを初期化します。推奨する代替 : System.Net.Mail |

MailAttachment コンストラクタ (String, MailEncoding)
アセンブリ: System.Web (system.web.dll 内)

Dim filename As String Dim encoding As MailEncoding Dim instance As New MailAttachment(filename, encoding)

Windows 98, Windows 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


- MailAttachment コンストラクタのページへのリンク