473,387 Members | 1,486 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

MailAttachment

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 = "te**@company.com"
mail.From = "te**@company.com"
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.
Nov 19 '05 #1
0 1006

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Tim T | last post by:
Hi, I hope there is someone reading this that has the answer, Please Help! I have the need to send a html email via asp.net. its easy enough to send an html email and add attachments. My...
1
by: nabil m | last post by:
hi i have 5 checkboxes i would like to when the user click on 1 or multiple checkbox i would like to email 1 or multiple files attachments to them ex: mailMsg.Attachments.Add(myAttachment+i); but...
1
by: Erick Daniel Tinajero | last post by:
Hi all: I am trying to do an automatic email sending process. I get some data from a database to know which files to send, then I add them through a Do ... Loop to my System.Web.MailMessage...
0
by: Bill L. | last post by:
We have an application that uses CDO to email large quantities of data as email attachments. We are migrating to a .Net application that does the same using the System.Web.Mail (SMTP) functionality...
0
by: Ghislain Tanguay | last post by:
Hi, I build a web service wo send email. I accept a binary array (the file),and a string containing the name of the file from the user if he want to send attchment file. Now, how can I put...
0
by: Chris Ashley | last post by:
How can I specify a different file name for my mailattachment? EG: newMailMessage.Attachments.Add(new MailAttachment(strLocation)); Say the file is named "243 - soc.pdf", I want to attach it...
1
by: Santosh | last post by:
Dear All i am writting a code sending mail with attachement. i am writting code for sending mail in one page and code for attaching a file in the next page. aftet attaching a file i am taking...
0
by: swarda | last post by:
Hi I have problem in attaching file while using ASP.net I have used FileUpload control of visual studio 2005. Now i want to attach more than one file using only one FileUpload control . Is it...
3
by: raj200809 | last post by:
when i m sending mail i received error from symantec Antivirus" Your email message was unable to be sent because your mail server rejected the message 550-5.7.1 the ip you’re using to send mail is...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.