URI Format Not Supported. [modified]
-
I am Sending a Mail with attachemts for this I have Made A WCF Which works fine when I give the Network path of the file. but I need to host It And when I try to give a URL path It Says. URI format not supported please Help My Code in WCF
public List funSendMail(Mailcls m) { List result = new List(); try { /* Create a new blank MailMessage with the from and to adreesses*/ System.Net.Mail.MailMessage mailMessage = new System.Net.Mail.MailMessage(m.Sender, m.Receiver); /*Checking the condition that the cc is empty or not if not then * include them */ if (m.Cc != null && m.Cc != string.Empty) { mailMessage.CC.Add(m.Cc); } /*Checking the condition that the Bcc is empty or not if not then * include them */ if (m.Bcc != null && m.Bcc != string.Empty) { mailMessage.Bcc.Add(m.Bcc); } //Ading Subject to the Mail mailMessage.Subject = m.Subject; //Adding the Mail Body mailMessage.Body = m.Body; /* Set the properties of the MailMessage to the values on the form as per the mail is HTML formatted */ mailMessage.IsBodyHtml = true; /* Bigining of Attachment1 process & Check the all file for a attachment */ if ((m.AttachfilesPath != null) && (m.AttachfilesPath.Count > 0)) { foreach (string s in m.AttachfilesPath) { result.Add("Attaching File : " + s); System.Net.Mail.Attachment attach = new System.Net.Mail.Attachment(s); /* Attach the newly created email attachment */ mailMessage.Attachments.Add(attach); } } /* Set the SMTP server and send the email with attachment */ System.Net.Mail.SmtpClient smtpClient = new System.Net.Mail.SmtpClient(); // smtpClient.Host = emailServerInfo.MailServerIP; //this will be the host in case of gamil and it varies from the service provider
-
I am Sending a Mail with attachemts for this I have Made A WCF Which works fine when I give the Network path of the file. but I need to host It And when I try to give a URL path It Says. URI format not supported please Help My Code in WCF
public List funSendMail(Mailcls m) { List result = new List(); try { /* Create a new blank MailMessage with the from and to adreesses*/ System.Net.Mail.MailMessage mailMessage = new System.Net.Mail.MailMessage(m.Sender, m.Receiver); /*Checking the condition that the cc is empty or not if not then * include them */ if (m.Cc != null && m.Cc != string.Empty) { mailMessage.CC.Add(m.Cc); } /*Checking the condition that the Bcc is empty or not if not then * include them */ if (m.Bcc != null && m.Bcc != string.Empty) { mailMessage.Bcc.Add(m.Bcc); } //Ading Subject to the Mail mailMessage.Subject = m.Subject; //Adding the Mail Body mailMessage.Body = m.Body; /* Set the properties of the MailMessage to the values on the form as per the mail is HTML formatted */ mailMessage.IsBodyHtml = true; /* Bigining of Attachment1 process & Check the all file for a attachment */ if ((m.AttachfilesPath != null) && (m.AttachfilesPath.Count > 0)) { foreach (string s in m.AttachfilesPath) { result.Add("Attaching File : " + s); System.Net.Mail.Attachment attach = new System.Net.Mail.Attachment(s); /* Attach the newly created email attachment */ mailMessage.Attachments.Add(attach); } } /* Set the SMTP server and send the email with attachment */ System.Net.Mail.SmtpClient smtpClient = new System.Net.Mail.SmtpClient(); // smtpClient.Host = emailServerInfo.MailServerIP; //this will be the host in case of gamil and it varies from the service provider
-
-
Looking at your code a bit more, I am not surprised. You're asking the mail code to do a HTTP transfer on your behalf, but I doubt that is supported. So, the error is correct. Why do you want to mail an image from a hard coded URL ? Why not make that image a local file ?
Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
-
Looking at your code a bit more, I am not surprised. You're asking the mail code to do a HTTP transfer on your behalf, but I doubt that is supported. So, the error is correct. Why do you want to mail an image from a hard coded URL ? Why not make that image a local file ?
Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
See That Image is a local file but Silverlight or WCf service can't access the local path of the client system. so i uploaded that on my server using a WCF for upload files. now attaching it to the mail. as silverlight has its contrains...
Thanks and Regards Meetu Choudhary My Web || My Blog || My Forums
-
See That Image is a local file but Silverlight or WCf service can't access the local path of the client system. so i uploaded that on my server using a WCF for upload files. now attaching it to the mail. as silverlight has its contrains...
Thanks and Regards Meetu Choudhary My Web || My Blog || My Forums
Well, I would imagine if there's a solution, it involves doing a HTTP request to get the file bytes, I know silverlight gives you a sandbox you could use to save the file, and then send it from there.
Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
-
Well, I would imagine if there's a solution, it involves doing a HTTP request to get the file bytes, I know silverlight gives you a sandbox you could use to save the file, and then send it from there.
Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
-
I have no idea, I know that expecting email code to take a URL as an attachment is not going to work, and I know you're still asking in the wrong forum. Perhaps someone in the right forum, will know enough to help you.
Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
-
I have no idea, I know that expecting email code to take a URL as an attachment is not going to work, and I know you're still asking in the wrong forum. Perhaps someone in the right forum, will know enough to help you.
Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
-
Well, spamming the whole site is just rude. Silverlight is the right forum. As I said in the outset, this has nothing to do with ASP.NET. The silverlight forum might be a little slower, you might wait a bit longer for a reply.
Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
-
Well, spamming the whole site is just rude. Silverlight is the right forum. As I said in the outset, this has nothing to do with ASP.NET. The silverlight forum might be a little slower, you might wait a bit longer for a reply.
Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
-
I am Sending a Mail with attachemts for this I have Made A WCF Which works fine when I give the Network path of the file. but I need to host It And when I try to give a URL path It Says. URI format not supported please Help My Code in WCF
public List funSendMail(Mailcls m) { List result = new List(); try { /* Create a new blank MailMessage with the from and to adreesses*/ System.Net.Mail.MailMessage mailMessage = new System.Net.Mail.MailMessage(m.Sender, m.Receiver); /*Checking the condition that the cc is empty or not if not then * include them */ if (m.Cc != null && m.Cc != string.Empty) { mailMessage.CC.Add(m.Cc); } /*Checking the condition that the Bcc is empty or not if not then * include them */ if (m.Bcc != null && m.Bcc != string.Empty) { mailMessage.Bcc.Add(m.Bcc); } //Ading Subject to the Mail mailMessage.Subject = m.Subject; //Adding the Mail Body mailMessage.Body = m.Body; /* Set the properties of the MailMessage to the values on the form as per the mail is HTML formatted */ mailMessage.IsBodyHtml = true; /* Bigining of Attachment1 process & Check the all file for a attachment */ if ((m.AttachfilesPath != null) && (m.AttachfilesPath.Count > 0)) { foreach (string s in m.AttachfilesPath) { result.Add("Attaching File : " + s); System.Net.Mail.Attachment attach = new System.Net.Mail.Attachment(s); /* Attach the newly created email attachment */ mailMessage.Attachments.Add(attach); } } /* Set the SMTP server and send the email with attachment */ System.Net.Mail.SmtpClient smtpClient = new System.Net.Mail.SmtpClient(); // smtpClient.Host = emailServerInfo.MailServerIP; //this will be the host in case of gamil and it varies from the service provider
Hi, Have you tried this .. this is not my code .. I got it from net...
Dim client As New WebClient Dim strURL As String = "http://www.someurl.com/sendfile.php?file=myfile.gz" Dim strFilename As String = Server.MapPath("myfile.gz") client.DownloadFile(strURL, strFilename)
-
Hi, Have you tried this .. this is not my code .. I got it from net...
Dim client As New WebClient Dim strURL As String = "http://www.someurl.com/sendfile.php?file=myfile.gz" Dim strFilename As String = Server.MapPath("myfile.gz") client.DownloadFile(strURL, strFilename)
-
-
server.mappath is being used to generate a local path(local to the server) .. u can use absolute path.
-
Dim client As New WebClient Dim strURL As String = "http://www.someurl.com/sendfile.php?file=myfile.gz" //Dim strFilename As String = Server.MapPath("myfile.gz") Dim strFilename As String = "c:\inetpub\wwwroot\my_app\images\myfile.gz" client.DownloadFile(strURL, strFilename)
i wanted to suggested this workaround .. as server.mappath is not working. -
Dim client As New WebClient Dim strURL As String = "http://www.someurl.com/sendfile.php?file=myfile.gz" //Dim strFilename As String = Server.MapPath("myfile.gz") Dim strFilename As String = "c:\inetpub\wwwroot\my_app\images\myfile.gz" client.DownloadFile(strURL, strFilename)
i wanted to suggested this workaround .. as server.mappath is not working. -
-
Well.. im not aware of what wcf supports .. but there must be some way to find the current directory's path
-