.net - System.net.mail Isbodyhtml = True Vs Two AlternateViews Pros/cons?
Dec 30, 2010
Here is the use case: I am making an app that will email HTML Newsletters. The app will also email a plain text version of the newsletter as an alternate view. The way I see it there are two ways of going about this when using the system.net.mail namespace. What are the pro/cons of these two ways, or is there a another way that I am missing?
On another programming related website, I saw this line in someone's signature. This is NOT the first time I've seen such sentiments, although this is the harshest:"People who work in VB or any variant thereof are not programmers, they are circus chimps throwing feces into an IDE..."VBA is my bread and butter and I can automate quite a bit of stuff with it. Yes, I know it lacks polish and some functionality, but why so much negativity toward it? On the flip side, what do other languages have that VB doesn't?
i am a seasoned vb6 and vb.net developer and where i currently work, they use VB6. Now, we develop a range of office plugins for a client, and they currently use vb6, they also do some other projects with vb6. I want them to change to vb.net They have asked me for a list of Pros for switching, and also some Cons.
The pros i have are: .Net is future proofed, VB6 will not be supported by Microsoft for much longer One standard platform to run on (.Net) removing problems of windows versions and missing dlls full OOP support and a generic Api for office application development. Integrate seamlessly with Java using bridging components (they are primarily a java house)Quicker performance On event application loading (in office) to help application performance. Application controls are loaded but the code to execute is only loaded when required, reducing application load on start up.Backwards compatible to Office and Outlook 2003
I have been reading up on Abstract classes and am thinking about utilizing them in an upcoming project.
I would like to know the pros and cons of using abstract classes from someone who has actually used them.
Additionally, I would like to know if the abstract class needs to be in it's own project or if they should be defined in an existing project and used within the application.
What are the pros and cons of standardizing on using Option Compare Text vs Option Compare Binary for VB.NET development?
- EDIT -Just some background since it seems like it would help - my development team has found it much easier to standardize on Option Strict On, Option Infer On, and Option Explicit due to their obvious advantages over the alternatives. What we haven't found as easy to standardize on is Option Compare Text/Binary as there seem to be advantages and disadvantages to both and different developers have differing opinions. Some of the arguments for each side have been as follows:
Some of the advantages/arguments for Option Compare Text:
It reduces verbosity in the code by removing the need for StringComparers and .ToLower() calls and StringComparison.OrdinalIgnoreCase all over the place Data needs are rarely concerned with casing, as evidenced by most databases being case-insensitive. Rarely would you ever really want to distinguish between THIS and This and this when doing a data comparison.
Certain specific use cases are simpler when you don't have to worry about casing. For example, handling ASP.NET control events where commands are sent to the codebehind as strings and casing-issues are difficult to track down as the compiler cannot help you. Think Select Case statements for <asp:repeater> events as an example.Many of the concerns raised about text comparison concern internationalization, which is often not that relevant to a lot of applications.VB specifically is case insensitive as a language, though Visual Studio helps you by at least enforcing consistency in your casing. SQL is case insensitive as well. Strings are the only place where you have to remember to worry about it, which highlights the awkwardness in ways you wouldn't normally notice it if you were worried about it everywhere.
Some of the advantages/arguments for Option Compare Binary:C# works this way, as do most other languages. It's somewhat unexpected to have alternate behavior and the unexpected is not good in programming.There is a slight performance penalty with Option Compare Text as evidenced by the IL generated on compile. Option Compare Binary doesn't have that penalty.Option Compare Text only makes certain parts of string handling case insensitive. But, it doesn't make it so that things like dictionary indexing are case insensitive by default. So, it's not like Option Compare Text actually makes it so that you don't have to worry about casing at all. If it only works half way, why bother?Programming is hard. It's best not to attempt to smooth over that fact. Worrying about string casing is part of the deal. Humans recognize THIS is different from This and tHiS. Of course your code should too - after all, they aren't really the exact same string.
I am teaching myself vb.net and wanted to change this code to have an embedded mail.boby from a text file instead of the file attachment. Code spippet below and where I need help is mail.Body = ("tracertALL.txt") that just puts the name of the file NOT the contents of the file. This code is a CMDWrapper that runs a batch file and I want the contents of a trace route that is pipe to a file >> tracertALL.txt .
I am tring to send e-mail used VB 2008. Below is my code. The error message I am getting is "5 Failure sending mail at System.Net.mail.client.send(MailMessage message).I have two questions. 1.) What am I doing wrong? & 2.) Is there a way the get a more description error message.
message As New System.Net.Mail.MailMessage Dim mySmtpsvr[code].....
I am trying to send E-mails asynchronously and it works fine as long as there isn't an AlternateView attached to the e-mail. When there is an alternate view, I get the following error:
Cannot access a disposed object. Object name: 'System.Net.Mail.AlternateView' System.Net.Mail.SmtpException: Failure sending mail. ---> System.ObjectDisposedException: Cannot access a disposed object.
I need a feedback form for my site.i need the user to write there.
Mail Title Info
And then when they press send then i get a mail to my hidden mail and a confirmation is send to the user mail.I have google the web but cant find any good info about this, i know how to make the form but how do i make the codebehind !?
Do any of u pro. have a link to a great tutorial or have a code that can be used !?
I have this unusual problem with mailing from my app. At first it wasn't working (getting unable to relay error crap) anyways I added the proper authentication and it works. My problem now is, if I try to send around 300 emails (each with a 500k attachment) the app starts hanging around 95% thru the process.
Here is some of my code which is called for each mail to be sent
am using system.net.mail to send email as shown below, but its too slow. it takes about a minute to send, whats wrong with my code. Am calling the code below in backgroundworker_dowork. is there a faster alternative, maybe free or open source code
' send the email ' Dim smtp As SmtpClient = New SmtpClient() Dim mail As New MailMessage()[code]............
I posted the following description before and the only suggestion that I received was to switch to System.Net.Mail code. I did switch and I continue to get the same randow and intermittent error.
Problem: Failure of in-house written VBScript that runs from a web page which calls CDO library to send an SMTP message.
Systems: About 100 Windows XP, Professional, Version 2002, SP2 clients using IE6 and IE7. Symantec 10.1.6.6010. All Microsoft patches are regularly installed.
Symptoms: Web application has sent messages for years without error. About December 2007 an intermittent failure began. About 5% of the SMTP messages are not being sent.
Research 1: Added code to trap error and got error number -2147220973 and error description, "The transport failed to connect to the server".
Research 2: Verified that the failed messages were not leaving the client by using a hardware network sniffer.
Research 3: Used SysInternals/ TCPView to monitor while sending messages.It didn't always show when a message was sent.Perhaps it needs to operate at a lower speed than 1 second. When TCPView did show something it was that ccApp.exe,Symantec antivirus,was communicating with the SMTP server.
Research 4: Reviewed all tools available in Sysinternals but didn't find any way to monitor the messages better than TCPView.
Research 5: Placed error checks throughout the code and proved that the error is in the iMsg.Send command.
I have developed application using vb.net for sending email. I tried to sent it from windows xp.its works fine .But When i try to send it from windows 2003 server but mail will not be sending.
I want to use System.Net.Mail.SendAync in an ASP.NET MVC2 application. I see that it throws an InvalidOperationException if there is already a SendAsync call in progress. Does this mean only one SendAsync is allowed per host, or per thread? For example, if I simultaneously have 2 web users from 2 different remote hosts, can each use SendAsync at the same time?
I am trying to send an email by using my MailEnable email account but this code produces the following exception:
"Syntax error, command unrecognized. The server response was: Welcome to MailEnable POP3 Server"
If I use port 8080, I get a timed out exception.
Private Sub SendWebMail() Dim myServer As New SmtpClient("listserv.company.com", 110) myServer.Credentials = New System.Net.NetworkCredential("Alert@mmail.company.com", "Password369")
In ASP.NET, I can just put my mailSettings in web.config and then ystem.Net.Mail.SmtpClient's default constructor will read them. In a regular VB.NETroject, not ASP.NET, I thought I could just put mailSettings in app.config. HoweverSmtpClient() doesn't appear to read settings from app.config. Is there a step I'm missing in order to tell a VB.NET application to read from app.config?
I am trying to use System.Web.Mail (using this example url...) to send email bit the Import is failing. The Imports knows of System.Web but there is no .Email.
I am trying to send an email message in HTML Format. I have a richtextbox the the user can change the color and font in the message. Below is the code I am using which ends up send in Text Format. Most codes I have found use System.WebMail which in vb 2008 is obsolete. This snippet is using System.Net.Mail namespace.
Public Shared Function SendEmailMessage(ByVal sendTo As String, _ ByVal sendFrom As String, _ ByVal sendSubject As String, _
Can someone provide a difinitive answer for how to code for System.Net.Mail (for VB)?I'm tryng to resolve the "System.IO.IOException Unable to read data from the transport connection " that cropped up after a recent Server update. The code was working fine until an update came down the other day.[code]
I'm having an issue where the ContentLength is being set to 0 when I try to use an external function to save a file toa server after I use the same file as an attachment:Dim tempFileColl As HttpFileCollection = Request.FilesDim tempFile As HttpPostedFile = tempFileColl.Get(0)
I get the following error:Application-defined or object-defined error.From what I can understand, it's when I attempt to attach a file to the email, I get that error. What I noticed is that it's because the file is in use.Is there anyway to attach the file anyway? My users are simply not closing their files after saving, right now I'm using computer manager to kick them out. The process is for them to save a file on a server through a share and then I pick that up and send it. Works fine as long as they close the file after save.
I use the System.Net.Mail namespace to send email messages in my application and I have a beta customer that reported that some characters were not coming through correctly on his CZECH box. I was not currently giving the option to the user to select an encoding, but I think that I actually should be.
I am using the System.Net.Mail namespace to create and send email messages. Everything was working fine until a couple of QC members of our team noticed something strange.
If they send emails from within my application and then leave the application open for a while (perhaps working on other tasks on the PC), when they try and activate my application again, it appears to be hung. The CPU is not pegged and everything appears to be normal in the task manager. We narrowed it down and it appears that this issue only manifests itself when MS Outlook is also opened and connected to a server.
I was playing around with process monitor, but nothing I saw was really glaring. I actually started deleting some threads on the PC and eventually my application became usable again.
Is there any possible way to send e-mail using VB.net on an Windows XP Home operating system? having to work around the IIS issue by jeopardizing my computer. I've looked around a lot and just can't figure it out for myself.