asp.net, c#, wfc, and attachment

Webboy2008
Webboy2008 used Ask the Experts™
on
I have the following codes in WFC. It works fine. But now need to add Attachment there.
Simple enough.
See any experts can help. 500 pts for working codes and please included aspx to call the WCF.



using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.IO;
using System.Net.Mail;
using System.Web.UI;
// NOTE: If you change the class name "EmailService" here, you must also update the reference to "EmailService" in Web.config.
public class EmailService : IEmailService
{    
    #region IEmailService Members
    public string SendeMail(string mFromEmail, string mToEmail, string mSubject, string mBody, string mFooter,Attachment mAttachment)
    {        
        string returnMSG = "";
        try
        {
            MailMessage MessageInfo = new MailMessage(mFromEmail, mToEmail, mSubject, mBody);
            MessageInfo.IsBodyHtml = true;
            SmtpClient EmailClient = new SmtpClient("mail.xxx.com");
            System.Net.NetworkCredential SMTPUserInfo = new System.Net.NetworkCredential("xxx@xxxcom", "xxx");
            EmailClient.UseDefaultCredentials = false;
            EmailClient.Credentials = SMTPUserInfo;            
            //====================================
           //add attachment here
            //====================================
            EmailClient.Send(MessageInfo);
            returnMSG = "Sent";
        }
        catch (Exception e)
        {
            returnMSG = "Unable to send email. ";
        }
        return returnMSG;
    }
    #endregion
}
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Full stack Software Engineer
Commented:
simple:

  //====================================
           //add attachment here

MessageInfo .Attachments.Add(mAttachment);

            //====================================

what wcf got to do with the code?
and what aspx ur looking?

Author

Commented:
I need to use aspx front end to call the wcf. Can you show me how to do it?

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial