Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Jeric 122 posts 192 karma points
    Mar 11, 2013 @ 18:58
    Jeric
    0

    mailMessage.Attachments.Add() to send translation file

    help needed, I need to send the translation file using the umbraco built in xml generatoras in "/umbraco/translation/xml.aspx?id=111" and to send the xml file as an email attachment.

    Is there any ways that I can send out the xml translation file through email without downloading it to the disk?

    Appreciate if there is any help or guide.

    Thanks

    Details on the code as below

     

    var mailMessage = new MailMessage(fromEmailAddress, toEmailAddress)

    {

    Subject = subject,

    SubjectEncoding = Encoding.UTF8,

    Body = RenderEmailTemplate(),

    BodyEncoding = Encoding.UTF8,

    IsBodyHtml = true

    };

     

    mailMessage.Attachments.Add(GetAttachment());

    var smtp = new SmtpClient();

    smtp.Send(mailMessage);

     

    private Attachment GetAttachment()
    {

    Attachment data = new Attachment(MapPath("/umbraco/translation/xml.aspx?id=111"), MediaTypeNames.Application.Octet);

    return data;
    }

Please Sign in or register to post replies

Write your reply to:

Draft