1

제 질문을 보내 주셔서 감사합니다.opennetcf.net.mail 첨부 파일 도움말

OpenNetCF.Net.Mail의 첨부 파일을 찾으려고합니다.

Attachment myAttachment = new Attachment(); 
message.Attachments.Add(myAttachment); 

문제는 내가 방법을 알아낼 수 없다는 것입니다 : 그것은 예정이다

public static void SendMessage(string subject, 
    string messageBody, 
    string fromAddress, 
    string toAddress, 
    string ccAddress) 
{ 
    MailMessage message = new MailMessage(); 
    SmtpClient client = new SmtpClient(); 

    MailAddress address = new MailAddress(fromAddress); 

    // Set the sender's address 
    message.From = address; 

    // Allow multiple "To" addresses to be separated by a semi-colon 
    if (toAddress.Trim().Length > 0) 
    { 
     foreach (string addr in toAddress.Split(';')) 
     { 
      message.To.Add(new MailAddress(addr)); 
     } 
    } 

    // Allow multiple "Cc" addresses to be separated by a semi-colon 
    if (ccAddress.Trim().Length > 0) 
    { 
     foreach (string addr in ccAddress.Split(';')) 
     { 
      message.CC.Add(new MailAddress(addr)); 
     } 
    } 

    // Set the subject and message body text 
    message.Subject = subject; 
    message.Body = messageBody; 

    // TODO: *** Modify for your SMTP server *** 
    // Set the SMTP server to be used to send the message 
    client.Host = "smtp.dscarwash.com"; 
    string domain = "dscarwash.com"; 
    client.Credentials = new SmtpCredential("mailuser", "dscarwash10", domain); 

    // Send the e-mail message 
    try 
    { 
     client.Send(message); 
    } 
    catch (Exception e) 
    { 
     string data = e.ToString(); 
    } 
} 

첨부 할 수 있도록 다음과 같은 방법으로 그것을 조정의 문제가 될 : 여기 내 센드 메일 기능에 대한 코드는 첨부 파일을 추가 할 수 있습니다. 위의 줄은 내가 첨부하고 싶은 파일을 실제로 말하고있는 중간에 뭔가 있어야합니다. 이 문제에 대한 도움은 크게 감사하겠습니다.

다시 한번 감사드립니다!

+0

여러 개의 첨부 파일이나 그 종류의 것을 원하십니까? –

+0

하나의 첨부 파일, zip 파일 – jnsohnumr

+0

첨부 할 때 어떤 코드를 사용하고 있으며 어떤 오류가 있습니까? 아니면 Attachment 클래스에 파일을 추가하는 데 필요한 API가없는 것입니까? – Quibblesome

답변

0

이 MSDN documentation에 따라 첨부 파일의 파일 이름을 매개 변수로 지정할 수 있습니다. 따라서 fullpath를 문자열 매개 변수로 지정할 수 있습니다.

+0

예, 할 수있었습니다. 그러나 문제는 opennetcf.net.mail 첨부 파일로 PocketOutlookAttachment를 캐스팅 할 수 없다는 것이고, 실제로 필요한 것입니다. – jnsohnumr

+0

@jnsohnumr, 커뮤니티 포럼의 오래된 스레드가 버그 인 것으로 나타났습니다. 그리고 그들은 그 버그를 결코 수정하지 않은 것처럼 보입니다. 여기를 참조하십시오 : http://community.opennetcf.com/forums/t/11325.aspx –

+0

감사합니다 어딘가 다른 곳에 링크 된 상용 제품을 사용하여 끝냈습니다 : http://www.enterprisedt.com/products/edtftpnetcompact/purchase.html – jnsohnumr

0

이메일 첨부 파일을 만드는 데 사용할 수있는 AttachmentBase입니다. 그러나 AttachmentBase의 인스턴스를 이메일 첨부 파일에 추가 할 수 없습니다.

Attachment 클래스는 AttachmentBase에서 상속해야한다고 생각합니다. 나는 이것이 아마도 결함이라고 생각한다.

+0

기본 "결함"은 첨부 파일을 결코 구현하지 않았다는 것입니다. 소스 코드를 살펴보면, 그 모든 것이 스텁 아웃되어 있습니다. 사실 여러 번 생각해 보았습니다. 그러나 현실은 내가 얻은 요청의 수를 여전히 한 손으로 계산할 수 있으며 항상 더 할 일이 많습니다. 어쩌면 다음 버전의 CF를 위해 다시 살펴 보겠습니다. – ctacke