MailAttachment

A

Alex

Hi,

I need some help with sending email from ASP.NET application. The problem is
that the file that I need to attach to the email is located on different
server. My code looks like this:

Dim mail As New MailMessage
mail.To = "(e-mail address removed)"
mail.From = "(e-mail address removed)"
mail.Subject = "test"
mail.Body = "This is a sample email"
Try
Dim attachment As New
MailAttachment("\\SERVER1\MyShares\Sample.csv") 'create the attachment
mail.Attachments.Add(attachment)

SmtpMail.Send(mail)
Catch ex As Exception
Response.Write("Exception occurred:" & ex.Message)
End Try

When I run the above code I get the following error:
Invalid mail attachment '\\SERVER1\MyShares\Sample.csv'.

I appreciate any help.

Alex.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Help with email form and mulitple attachments 7
FileUpload and mail sending 2
Can't SendMail 3
Send Email 3
mail Attachment program in c# 1
sending emails via site. 3
Sending Mail 1
Problem on sending emails 1

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,584
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top