Aracılığıyla paylaş


MailAttachment Oluşturucular

Tanım

MailAttachment sınıfının yeni bir örneğini başlatır. Önerilen alternatif: System.Net.Mail.

Aşırı Yüklemeler

MailAttachment(String)

Ek için belirtilen dosya adıyla sınıfının yeni bir örneğini MailAttachment başlatır. Encoding Özelliği varsayılan olarak olarak UUEncode olarak ayarlar. Önerilen alternatif: System.Net.Mail.

MailAttachment(String, MailEncoding)

Ek için belirtilen dosya adı ve kodlama türüyle sınıfının yeni bir örneğini MailAttachment başlatır. Önerilen alternatif: System.Net.Mail.

MailAttachment(String)

Ek için belirtilen dosya adıyla sınıfının yeni bir örneğini MailAttachment başlatır. Encoding Özelliği varsayılan olarak olarak UUEncode olarak ayarlar. Önerilen alternatif: System.Net.Mail.

public:
 MailAttachment(System::String ^ filename);
public MailAttachment (string filename);
new System.Web.Mail.MailAttachment : string -> System.Web.Mail.MailAttachment
Public Sub New (filename As String)

Parametreler

filename
String

Ek dosyasının adı.

Örnekler

//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 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

Açıklamalar

Posta gönderilirken posta eki dosyası kilitlenir.

Şunlara uygulanır

MailAttachment(String, MailEncoding)

Ek için belirtilen dosya adı ve kodlama türüyle sınıfının yeni bir örneğini MailAttachment başlatır. Önerilen alternatif: System.Net.Mail.

public:
 MailAttachment(System::String ^ filename, System::Web::Mail::MailEncoding encoding);
public MailAttachment (string filename, System.Web.Mail.MailEncoding encoding);
new System.Web.Mail.MailAttachment : string * System.Web.Mail.MailEncoding -> System.Web.Mail.MailAttachment
Public Sub New (filename As String, encoding As MailEncoding)

Parametreler

filename
String

Ek dosyasının adı.

encoding
MailEncoding

Ekin MailEncoding türü.

Şunlara uygulanır