Here's an example snippet:

using System.Web;
using System.Web.Services;
using System.Web.Mail;

private void sendMail(string From,string To, string CC,string Subject,
string BodyText,string BCC,string Attachment)
          {

               MailMessage mm=new MailMessage();


               mm.From=From;
               mm.To=To;
               mm.Subject=Subject;
               mm.Body=BodyText;
               mm.Cc=CC;
               mm.Bcc=BCC;
               mm.Priority=MailPriority.Normal;

               MailAttachment ma=new
MailAttachment(Server.MapPath(Attachment));//attachment is the filename.
If //he file is on another machine, obviously don't use MapPath . . .

               mm.Attachments.Add(ma);

               SmtpMail.SmtpServer=YOURSMTPSERVERADDRESS;

               SmtpMail.Send(mm);
          }

If the filepath for the attachment is elsewhere, make sure the app has the
appropriate permissions to get to the file.


Steve Holak
Senior Software Architect

Brokerage Concepts IS Dept.
610-491-4879

email:  [EMAIL PROTECTED]



                    Renu Sharma
                    <renu_sharma@INFOS        To:     [EMAIL PROTECTED]
                    YS.COM>                   cc:
                    Sent by: dotnet           Subject:     [DOTNET] Sending doc as an 
attachment through mail
                    discussion
                    <[EMAIL PROTECTED]
                    VELOP.COM>


                    05/29/2002 11:53
                    AM
                    Please respond to
                    dotnet discussion






Does anybody have code for sending any document as an attachment through
mail

Thanx,
Renu



You can read messages from the DOTNET archive, unsubscribe from DOTNET,
or subscribe to other DevelopMentor lists at http://discuss.develop.com.

You can read messages from the DOTNET archive, unsubscribe from DOTNET,
or subscribe to other DevelopMentor lists at http://discuss.develop.com.

You can read messages from the DOTNET archive, unsubscribe from DOTNET, or
subscribe to other DevelopMentor lists at http://discuss.develop.com.

You can read messages from the DOTNET archive, unsubscribe from DOTNET, or
subscribe to other DevelopMentor lists at http://discuss.develop.com.

Reply via email to