Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when adding attachment [sf#16] #15

Closed
nilnull opened this issue Apr 15, 2019 · 0 comments
Closed

Error when adding attachment [sf#16] #15

nilnull opened this issue Apr 15, 2019 · 0 comments
Milestone

Comments

@nilnull
Copy link
Owner

nilnull commented Apr 15, 2019

Reported by rkmoray on 2018-07-25 12:53 UTC
I amd trying to add an attachment to an email, When the add attachment line is read, I get an object error.
Here is the code
var mymessage = new MimeMailMessage
{
From = new MimeMailAddress(Mail),
Subject = "Web Purchase Receipt " + DateTime.Now.ToString("yyyyMMdd"),
Body = "body"
};
mymessage.To.Add("me@hotmail.com");
var mailer = new MimeMailer(Host, 465)
{
User = User,
Password = Pass,
EnableImplicitSsl = true,
AuthenticationMode = AuthenticationType.Base64
};
var a = new MimeAttachment("c:\temp\Integra POS.pdf")
{
//ContentType = new ContentType("application/pdf"),
ContentType = new ContentType("application/octet-stream"),

            Location = AttachmentLocation.Inline
        };
        AttachList.Add(a);

        foreach (Attachment t in AttachList)
        {

            mailer.MailMessage.Attachments.Add((MimeAttachment)t);//Error on the line
        }
        ((SmtpSocketClient)mailer).SslType = SslMode.Ssl;

        mailer.SendCompleted += SendCompleted;
        mailer.SendMailAsync(mymessage);
@nilnull nilnull added this to the 1.0 milestone Apr 15, 2019
@nilnull nilnull changed the title Error when adding attachment Error when adding attachment [sf#16] Apr 15, 2019
@nilnull nilnull closed this as completed Sep 4, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant