|
The documentation for System.Web.Mail.SmtpMail states that only the following platforms are supported: Windows 2000, Windows XP Professional, Windows Server 2003 family.
Indicative code for getting the OS and CLR version numbers is as folows:
using System;<br />
Console.WriteLine("OSVersion: {0}", Environment.OSVersion.ToString());<br />
Console.WriteLine("CLRVersion: {0}", Environment.Version.ToString());
Please see my article
here[^] for more details:
Salil Khedkar [^]
|
|
|
|
|
There is an issue, and you should not use System.Web.Mail . It requires a CDO server to be installed. Current CDO servers include Microsoft Exchange Server (requires NT Server; the Exchange version may require newer NT-based Windows platforms as well), or the Microsoft SMTP Services which, IIRC, started shipping with Win2K server (perhaps professional, but I don't remember off-hand).
Sending SMTP messages is really not hard at all. Just search this site for SMTP using the search box at the top of every page, or even this forum by clicking "Search comments". I personally have posted numerous examples, as well as sample source in an article on this site to resolve MX records for a specified domain (you need to know the SMTP server to send mail to). The SMTP protocol - at least for simply sending messages with no more support than MailMessage would give you - is very simple.
Note that in .NET 2.0 (formerly named "Whidbey") Microsoft will ship as part of the BCL SMTP and MIME support in classes that do not require CDO.
The System.Web.Mail classes - which should be evident by the parent namespace - is meant for use with ASP.NET, which is typically (but not limited to) run on IIS, where you can also install the Microsoft SMTP Services to send or forward mail, as well as queue received mail.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
Thank you for your reply,
Actually, i was using a class called smtpEmailer that i took on this site http://www.codeproject.com/csharp/smtpemailer.asp but i have a problem with the attachments, which i need to send.
Everything works fine with the class, but when i send a email with an attachment, the email is sent/received with no problem but i can't see the attachment. It is like the message had no attachment at all, except for the fact that the attachment is there, since an empty body message is 400k big (when i put a 400k attachment). I searched a lot to find a solution for this problem but haven't found yet. This is the commands i send in the socket for a basic email with a text file attachment:
<br />
HELO xxxx.xxxxxx.com<br />
MAIL FROM:<xxxx@xxxxxxxxxx.com> <br />
RCPT TO:<xxxx@xxxxxxx.com><br />
DATA<br />
MIME-Version: 1.0<br />
X-Mailer: SST_OnSite.SmtpEmailer<br />
FROM: xxxxx@xxxxxxxx.com<br />
TO: xxxx@xxxxxxxx.com<br />
REPLY-TO: xxxx@xxxxxxxxxx.com<br />
DATE: Wed, 27 Oct 2004 19:20:34 GMT<br />
SUBJECT: TEST<br />
Content-Type: multipart/mixed; boundary="#SEPARATOR1#"<br />
<br />
<br />
This is a multi-part message in MIME format.<br />
<br />
--#SEPARATOR1#<br />
Content-Type: application/octet-stream; name="a.txt"<br />
Content-Transfer-Encoding: base64<br />
Content-Disposition: attachment; filename="a.txt"<br />
Content-ID: <a><br />
<br />
<br />
--#SEPARATOR1#<br />
Content-Type: multipart/alternative; boundary="#SEPARATOR2#"<br />
<br />
<br />
--#SEPARATOR2#<br />
Content-Type: text/plain; charset=iso-8859-1<br />
<br />
<br />
Your email client does not support MHTML messages<br />
<br />
<br />
--#SEPARATOR2#<br />
Content-Type: text/html; charset=iso-8859-1<br />
Content-Transfer-Encoding: quoted-printable<br />
<br />
<br />
This is the body of the message<br />
--#SEPARATOR2#--<br />
<br />
<br />
--#SEPARATOR1#--<br />
<br />
<br />
.<br />
QUIT
I know the server works fine (i have no problems with attachments when i send them with System.Web.Mail namespace or with Outlook)
Any Help with this would be appreciated
Thanks
Hugo Migneron
|
|
|
|
|
The fact that you're sending a.txt as an "application/octet-stream" may be the problem as your server or the receiving server - especially these days - is probably stripping it off as a potential threat. Extensions with MIME don't matter, but certain things can be inferred as common threads. Sending a .txt file as a binary stream is one obvious one. You should send it as some text/* MIME type using the appropriate charset with the Content-dispostion set to "attachment".
If you're having problems with a particular third-party library like this, you need to contact the author to get it resolved. There are also a lot of other third-party applications out there to handle this. A good - but cheap - commercial library you can get from IP*Works![^]. S/MIME is even supported if you need it.
Writing your own also isn't that hard, especially if you end up using the same template and don't need the extensibility of a library. I've done this in a couple cases. It's quick, simple, and - for something that doesn't change often - cheap!
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
I understand how to interrogate the mouse position in an event handler, but how do I programmatically force the mouse cursor to a specific x,y position?
Thanks!
Mark
|
|
|
|
|
Assign the wanted screen coordinates as a Point to the static Cursor.Position property.
www.troschuetz.de
|
|
|
|
|
hi,
i'm creating a simple windows form control,this control contains
some panels but during design time this panels are accessible by clicking on them,i want to know what should i do inorder to disable selecting these panels...
|
|
|
|
|
You wrote :
some panels but during design time this panels are accessible by clicking on them,i want to know what should i do inorder to disable selecting these panels...
I am not getting your clear requirement. What got from this is , you are trying to control the accessiblity on design time. Accessibility is only come into picture when you use that perticular form.
If you can give clear picture of your requirement. Then i can able help you out.
Sreejith Nair
[ My Articles ]
|
|
|
|
|
hi,
you know,during design time i can select,change or move the panels but i dont want to do so,i just want to change he properties of panels by the properties panel which the parent gives to us...
thanks..
|
|
|
|
|
|
Select the control - then in Properties window set the "Locked" property to True. This will stop you being able to move or resize the control whilst still being able to change its properties. Is this what you were trying to do ???
|
|
|
|
|
infact this is not what i need,in this way(locking the control)users can find out that there is a control inside the parent control.pretend statusbar,when we add a panel to it ,just a panel shows inside the statusbar but we can not choose it.maybe i'm using the wrong way....is it possible that during design time controls draw a schema of their runtime ?
|
|
|
|
|
Hi all,
using C# code i have created a new user account (by using Directory Service Entry) because i need that a new user is created when i install my application so that my app can run as like that user.
The problem is that the new user accont appears on win xp start up and i don't want others users could see than the account exists.
So i'm searching if exists a property ( in ADS_USER_FLAG_ENUM for setting user properties) can be adding in order to make hidden the user control created at the start up, after installation of my app!..but no result of my search!
Someone can help me and have got any suggestion to hide an user account using C#.NET code?
Thanks
Regards
|
|
|
|
|
Sounds strange.
I'd say, if some Software creates a new Account on my computer, i'd want to know.
Cheers
Sebs
|
|
|
|
|
The code is about like this,
and i think that there would be a property for the account to hide it when login after reboot the machine:
///
/// account property user flags
///
const int ADS_UF_PASSWD_CANT_CHANGE = 0x40;
const int ADS_UF_NORMAL_ACCOUNT = 0x200;
const int ADS_UF_DONT_EXPIRE_PASSWD = 0x10000;
// add the user
DirectoryEntry account = root.Children.Add(AccountName, "user");
account.Invoke("SetPassword", new object[] {pw} );
account.Invoke("Put", new object[] {"Description", "Built-in account for my
Application"});
// set a few properties
int userfalgs = EXPIRE_PASSWD|ADS_UF_NORMAL_ACCOUNT|ADS_UF_PASSWD_CANT_CHANGE;
account.Properties["UserFlags"].Add(userfalgs);
account.CommitChanges();
|
|
|
|
|
Yeah, sounds very strange!
Why does your application need it's own account? Usually, the only time this ever needs to happen is if your application is running as a service...
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Infact, suppose that the application must run as a service and i need to do this
|
|
|
|
|
//vc++ code:
ZeroMemory( &SPTWB, sizeof( SCSI_PASS_THROUGH_WITH_BUFFERS ) );
How to do this in c#? Or there is another function to do the same work in C#?
|
|
|
|
|
|
Hi!Nair,
Thank you very much for your kindness help.
But tonight I have to work off. So,see you next day.
see u tomorrow!
Good luck!
momer
|
|
|
|
|
I don’t think you can do something like this with managed code. The concept of managed code enforces that allocated memory is all defaulted to a logical default value (like null, zero, false etc) and secondly you can not access memory beyond the bounds of your variable.
With unmanaged code, yes, you should be able to do this.
Salil Khedkar [^]
|
|
|
|
|
Hi, i've got this form which connects to database during form load. i'm using relative path connection.however, after i convert this form to a userControl, i can't add this userControl. it says that the program can't locate my database in this address: C:\Program Files\Microsoft Visual Studio .NET 2003\Common7\IDE\myDataBase.mdb. But i did not do my work in that address!! so why would it look for my database there? But if i change my connection to a absolute path, it works. is it possible i remain using a relative path while using userControl.
chris
|
|
|
|
|
The problem you have is that your using relative paths! Don't ever do this! Your assuming that the current directory is the one that the application is started from. THis is almost never the case! Instead, build an absolute path to your database using the Path.Combine method and the Application.StartupPath property:
using System.IO;
.
.
string absDBPath = Path.Combine( Application.StartupPath, "mydatabase.mdb" );
Also, it's very bad practice to have an application hold open a connection to a database, or any other resource for that matter, for the life of the app or control. When using expensive and scarce resources, such as database connections, ALWAYS open the connection as late as possible, do your database work, then close and release the connection as early as possible. Holding open a connection to the database wastes money and memory on the server. Since your application spends 98% of its life idling, you're hogging a connection license and memory on the server and doing nothing with it!
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
hi, sorry i think you made a mistake. the connection that your talking about is relative path which i'm using. this is my coding:
OleDbConnection conn = new System.Data.OleDb.OleDbConnection(); conn.ConnectionString = @"Provider=Microsoft.Jet.OLEDB.4.0;" +<br />
@"Data source = "+Application.StartupPath +@"\myDatabase.mdb";
the current directory i'm working in is (C:\Documents and Settings\020670F\My Documents\020670F\FYP backup\SingaporeCrusieCentre\bin\Debug\myDataBase)
as i've mention earlier, after i convert my form to a userControl, i can't add the userControl i've created. it says that it cant locate my database in (C:\Program Files\Microsoft Visual Studio .NET 2003\Common7\IDE\myDatabase). i'm confused because i did not do my project in that directory. it works after i use a absolute path connection. Please Help. Thanks
Chris
|
|
|
|
|
nuttynibbles1984 wrote:
the connection that your talking about is relative path
No, it's not. Application.StartupPath returns a completely qualified absolute path, starting with a drive letter. A relative path would look something like "..\..\subDir1\subDir2\myDatabase.mdb".
Hmmm...I don't know what you did. When I used Application.StartupPath , I got the path to the bin folder in my project folder. Something like this:
"C:\Documents and Settings\[userID]\My Documents\Visual Studio Projects\RegistryAccess\bin"
This worked in either a Windows Forms project or in a Control Library project. In the later case, it always returns the path to the application that is hosting the control.
BTW: What do you mena you "converted" your app from a Windows Forms project to a Control project? What did you do?
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|