Converting from System.Web.Mail to System.Net.Mail - Is this correct??

Hi there, I'm from Argentina. I've converted System.Web.Mail (code is underlined) to System.Net.Mail (code is Bold) . I'd like to know if it's correct. Thanks !!

public uint enviar()
                // Abrir el archivo que contiene el template del HTML.
                // Envia el mail con el HTML.
                MailMessage Message = new MailMessage();
                //Message.From = CShared.devolverValorConfig("em.remitente");
                Message.From = new System.Net.Mail.MailAddress CShared.devolverValorConfig("em.remitente"));
                //Message.To = string.Join(";", destinatarios);
                Message.To.Add (string.Join(";", destinatarios));

                if (this.enviarSinFormato == false)
                    //Message.BodyFormat = MailFormat.Html;
                    Message.IsBodyHtml = true;
                    //message.BodyFormat = MailFormat.Text;
                    Message.IsBodyHtml= false;

                foreach (string fileName in attachments)
                    //MailAttachment ma = new MailAttachment(fileName);
                    Attachment data = new Attachment(fileName);



                Message.Subject = this.asunto;

                    // Enviar el mail
                    Message.Body = resolverCuerpo();
                    //SmtpMail.SmtpServer = servidorSMTP;
                    SmtpClient smtpClient = new SmtpClient (servidorSMTP);

                    /// TODO: Hacer este paso asincrónico (utilizando System.Threading.Thread)

                catch(System.Web.HttpException ehttp)
                    // TODO: Registrar el error en un log.
                    Console.WriteLine("{0}", ehttp.Message);
                    Console.WriteLine("Error completo derivado de HttpException: ");
                    Console.Write("{0}", ehttp.ToString());
                    throw new HttpException(ehttp.Message, ehttp);
            catch(System.Exception e)
                // TODO: Registrar el error en un log.
                Console.WriteLine("{0}", e.Message);
                throw new Exception(e.Message, e);
            return 0;
3/17/2009 3:50:39 PM 93655 articles. 6 followers. Follow

1 Replies

Similar Articles

[PageSpeed] 10

Run it.  See if it works.  If it doesn't, take note of the exception messages and google them.


Regards Mike
My site
3/17/2009 7:55:52 PM

Similar Artilces:

Help for Visual web dev isolate system.web.mail to
Hi all,  I'm new user to visual web developer express software. Laterly i found this application isolate quite some of the component namespace, like system.web.mail to net.mail. I not well understand how functional?? Does it act same as system.web.mail?? My coding below: change system.web.mail to which causing a lot error... *****Can anybody correct me or advise me how to make this code work in <%@import Namespace="" %> <script runat="server">    Public FromAddress As String = "" .......

System.web.mail to
I converted a web app from VS 2003 to VS 2005. i now get error message when i build it  stating system.web.mail  is obsolute,  use i redefine to but now i get other error message such as smtpMail does not exist in the current context. cannot implicitly convert type string to System.Net.Mail.MailAddress   so System.Web.Mail want work in web app convert to VS 2005 running on framework 2.0?           because if i change to System.Net.Mail  i am ...

switching from system.web.mail to
I have been converting my code from system.web.mail to  I have been able to convert the to, from, cc, and message body to the new format easily question is how do i convert this into format?SmtpMail.SmtpServer = "server";                SmtpMail.Send(mail);Would this be the solution?SmtpClient client = new SmtpClient("server");                client.Send(mail); Here's a full example of how to per...

Changing System.Web.Mail to System.Net.Mail
I am trying to learn ASPI have been using the Visual Web Developer 2005I have the following line that I can not work out how to convert.<%Dim FromForm As String = ""Dim ToMe As String = ""Dim FormSubject As String = "Contact Infomation"Dim EmailText As String = "Blar Blar Blar"System.Web.Mail.SmtpMail.Send(FromForm,ToMe,FormSubject,EmailText)%>It tells me that I cannot use System.Web.Mail any more and should use System.Net.Mail. I have been unable to work out what the new code should be to get it to work.The Language is VBCan anyone tell me how to change...

Migrating from System.web.mail to
Hi Every1,I've recently used the System.web.mail to send mail, using the IIS's smtp server.Doing this, i didn't really need to do anything in the web.config file or give any special parameters to the client. It just assumed i was working with my very own smtp service that came with the IIS and everything worked fine.Now i migrated to and now i need to insert my smtp service's host location under <> in the web.config file.However, i don't know what to write there so the client will use my smtp sevice (host="localhost" doesn't work)can any1 help me on this one?t...

difference between System.Web.Mail and System.Net.Mail
What is difference between System.Web.Mail and System.Net.Mail  namespace?What is use of both ? System.Web.Mail was in .NET Framework v1.1System.Net.Mail is in .NET Framework v2.0 and greaterSame use, although there is more functionality in System.Net.Mail since it is a later version of the framework. Darrell Norton, MVPDarrell Norton's BlogPlease mark this post as answered if it helped you!  What All-Star said. I assume the reason it was moved to a different namespace is because the internet is actually a suite of technologies: e-mail, ftp, http (web), etc. E-mail and...

Working with System.Web.Mail but not with System.Net.Mail
Hi, i am having trouble sending e-mails using System.Net.Mail namespace while there is no problem with System.Web.Mail. I am  using remote smtp server with no authentication.  My code as shown below:1 try2 {3 MailMessage message = new MailMessage();4 message.BodyFormat = MailFormat.Html;5 message.To = "";6 message.From = "";7 message.Subject = "Test Smtp";8 message.Body = "TestMail 123";9 10 SmtpMail.SmtpServer = "mail.mysmt...

System.Web.Mail vs System.Net.Mail
Hi AllI was using System.Web.Mail in an application on our test server.  That worked fine.  I never had to specify a server or change any settings.  It just works.  Whatever settings the server has set up are used.  This is great.I saw that System.Web.Mail has been deprecated, so I'm trying to use System.Net.Mail.  I'm having a problem.  Net.Mail doesn't use whatever settings Web.Mail used.  I can't send e-mail with Net.Mail.  I see several people use the web.config file to set the server up, but I can't get that to work. I jus...

Problem with difference between System.Web.Mail and System.Net.Mail in using attachments
I have a web .Net app which sends emails with attachments.  After the email is sent I clean up aftermyself and delete the attachments from disk.   In upgrading to .Net 2  I changed the email logic from using system.web.mail to  (of course vs is telling me system.web.mail is obsolete).In .Net 1.1,  the files deleted with no problem but in .Net 2 when I attempt to delete  I receive The process cannot access the file ...' because it is being used by another process. If I change the code back to using system.web.mail I can delete the file...

What additional advantage we get through over the old system.web.mail?
What additional advantage we get through over the old system.web.mail?Is it needed to configure the smtp server? Plz tell me the steps to develop the email sending facility in our applicationSwati Jain Take a look at Don't forget to click "Mark as Answer" on the post that helped you. That way future readers will know which post solved your issue....

Value of type 'System.Net.Mail.MailMessage' cannot be converted to 'System.Net.Mail.AlternateView'
Trying to create an alternateview to send a txt email with the html formatted email.  I've used string builder to create the whole email, but I get this error.  Any ideas why?  i've bolded the line that throws the error... Dim EmailBodyTxt As New StringBuilder EmailBodyTxt.Append("<html><style type='text/css'>.table{border:solid; border-color:#006666; width:600;} ")EmailBodyTxt.Append("<body><table class='table'><tr><td colspan='2'><h1>Test<br />RESPONSE SYSTEM</h1></td>...

System.Net.Mail is giving error CS0029: Cannot implicitly convert type 'string' to 'System.Net.Mail.MailAddress'
I'm getting an error while trying to use the wizard to create a form and than pass it the vaibles to Mail. Any help would be much appreciated. SmtpClient smtpClient = new SmtpClient(); MailMessage message = new MailMessage(); try {   message.From = txtEmail.Text; message.To.Add(""); message.Subject = "Feedback"; message.CC.Add(""); message.CC.Add(""); message.IsBodyHtml = false; message.Body = txtMessage.Text; smtpClient.Send(message); lblStatus.Text = "Email successfully sent."; } catch (Exception ex) { lbl...

System.Web.Mail.MailMessage.UrlContentBase in System.Net...
Is there an equivalent of UrlContentBase and UrlContentLocation in System.Net.*??The views, opinions, and judgments expressed in this message are solely those of the author. The message contents have not been reviewed or approved by Convergence Communications Consultants....

.net 2 beta 2 - System.Net.Mail
Hi guysI'm using the System.Net.Mail namespace in .net version 2, beta 2, to send out some HTML formatted e-mails.However, for some reason when the e-mail are sent out some of the full stops from the e-mail are removed.For example, part of the e-mail contains this code<img src="" alt="">But this is what the code is like when the e-mail source code is viewed<img src="" alt="">Is this a known bug in beta 2? If so, where can I view a list of known bugs an...

Web resources about - Converting from System.Web.Mail to System.Net.Mail - Is this correct?? -

Facebook Begins Converting Users To HTTPS
Are you willing to sacrifice a little bit of speed for a lot more safety? Facebook is asking that very question with its announcement that it ...

Facebook No Longer Converting Groups Into Pages
Back when Facebook first launched Facebook Pages, many businesses and brands who had built up substantial audiences in their Facebook Groups ...

Vert - simply converting for iPhone, iPad, and iPod touch on the iTunes App Store
Get Vert - simply converting on the App Store. See screenshots and ratings, and read customer reviews.

Converting SIM Card to Micro SIM Card - Flickr - Photo Sharing!
Place new Micro SIM into the iPhone SIM card tray

Ayaan Hirsi Ali on Converting Muslims to Christianity - YouTube
Complete video at: Ayaan Hirsi Ali explains her support of missionary ...

Click go fears of converting print files
Is there a way to convert a print queue item to a .RTF or .PDF file? I like to save or email them. - The Sydney Morning Herald

Sudanese woman ordered to hang under sharia law for converting to Christianity gives birth
Khartoum, Sudan: A Christian Sudanese woman sentenced to hang for apostasy has given birth in jail, a Western diplomat said on Tuesday.

Imams warn against radicalism to Aboriginal inmates converting to Islam
The prison system has enlisted the help of ASIO to crack down on radicalisation behind bars amid revelations that Aboriginals are converting ...

Converting the world's companies one by one - The Science Show - ABC Radio National (Australian Broadcasting ...
Image: Trucks carrying logs make their way up a road in Jambi, Indonesia. A vast area of the Sumatran forest, and orangutan habitat, is being ...

Converting Churches Into Homes Is The Latest Hollywood Trend
You don't have to be a believer to be moved by the beauty of a church.

Resources last updated: 12/7/2015 12:31:15 PM