|
Hi, I'm having a problem with my mail sending code. The latest version of Outlook Express strips out my html and screws it all up, complaining of "potentially harmful" attachments, etc, rendering the final email ugly. It seems that by specifying HTML formatting, the MailMessage class is generating text and html formats of the message and attaching the html for people who have html support. How do I make it not try and be fancy and "helpful" in this way, and just format the whole email as html, like I want it to? When it tries to make a text version of the email, it ends up splitting long URLs over two lines, and then outlook screws them up. In trying to be more "functional", MailMessage is ending up being a pain in the butt.
public void Send()
{
MailMessage msg = new MailMessage();
string mailto = _recipients[0];
for(int i=1; i<_recipients.Count; i++)
mailto += ";" + _recipients[i];
msg.To = mailto;
msg.Subject = _subject;
msg.From = _from;
if(_useTemplate)
{
foreach(DictionaryEntry de in _keys)
_body = _body.Replace(de.Key.ToString(), de.Value.ToString());
}
msg.BodyFormat = _isHtml ? MailFormat.Html : MailFormat.Text;
msg.Body = _body;
SmtpMail.Send(msg);
}
NATHAN RIDLEY
Web Application Developer
email: nathan @ netlab.com.au
[remove the spaces before and after the @ symbol]
|
|
|
|
|
Not a direct answer, but be careful - some spam detection scripts/filters (certainly SpamAssassin) doesn't look too kindly on html-only email
I guess the reasoning is if someone sends you an email and really wants you to view it as HTML, then you have to ask yourself what's hidden in that HTML that makes it so necessary for you to view it?
--
Help me! I'm turning into a grapefruit!
Phoenix Paint - back from DPaint's ashes!
|
|
|
|
|
has anyone here ever developed a synchronizer or file transfer program...
i want to develop a file transfer type program to tranfer photos from my phone to my pc...
can anyone here share some web links to code so i can reference something similar, it would be great...
i also plan to give out...once developed...
thanks
The Devil Lives in all of us, It's up to you to let HIM/HER out!!!!!
|
|
|
|
|
Hi velkropie,
If your mobile is ms smartphone operated than Microsoft ActiveSync is developed for this task.
Also MSDN Mobility Center[^] will be of much help.
Else you will have more chance at a more appropriate forum.
|
|
|
|
|
How can I close all Child Form by clicking a button from the Parent Form ?
|
|
|
|
|
For that to even work, the child forms need to be modeless, so you'll have variables in the main form that represent the other forms. Call their close methods.
Christian
I have several lifelong friends that are New Yorkers but I have always gravitated toward the weirdo's. - Richard Stringer
|
|
|
|
|
if ur child forms are simply owned by the parent form then:
foreach(Form frm in this.OwnedForms)
{
frm.Close();
}
else if they are MdiChilds then:
foreach(Form frm in this.MdiChildren)
{
frm.Close();
}
|
|
|
|
|
I am getting this error message when I try to bulk load some data from an XML file:
QueryInterface for interface Interop.SQLXMLBULKLOADLib.ISQLXMLBulkLoad failed.
Here is my C# code that calls my interop assembly:
[STAThread]
public void BulkLoad( string schemaFilePath, string file, string identifier )
{
Interop.SQLXMLBULKLOADLib.ISQLXMLBulkLoad bulkLoader = new Interop.SQLXMLBULKLOADLib.SQLXMLBulkLoad3Class();
bulkLoader.ConnectionString = connectionString;
bulkLoader.ErrorLogFile = GetParameter( "TempDirectory" ) + @"\" + identifier + ".error.log";
bulkLoader.TempFilePath = GetParameter( "TempDirectory" );
bulkLoader.Transaction = true;
bulkLoader.CheckConstraints= false;
bulkLoader.XMLFragment = true;
bulkLoader.SchemaGen = true;
bulkLoader.IgnoreDuplicateKeys = false;
bulkLoader.Execute( schemaFilePath, file );
bulkLoader = null;
}
Any ideas?
Thanks.
-Matt
------------------------------------------
The 3 great virtues of a programmer:
Laziness, Impatience, and Hubris.
--Larry Wall
|
|
|
|
|
perlmunger wrote:
QueryInterface for interface Interop.SQLXMLBULKLOADLib.ISQLXMLBulkLoad failed.
This means that it was unable to return an interface pointer from a specific class (coclass really in MIDL terms). You should make sure that the COM component is registered on the machine your attempting to create it on and that the class itself implements the interface you are requesting.
- Nick Parker My Blog | My Articles
|
|
|
|
|
Hello all! Does anyone know of a good way to store information about the peers of a peer-to-peer network thru a web service? I want to be able to store this information locally on my server to tell others how to connect to each other thru the TcpListener / TcpClient objects.
Here's the scenario. Suppose I have a user, let's say Fred. I want to be able to store information about another user, again, let's say Joe.
Now, just passing the Port that Joe is listening on is all good IF, Joe is the only one on his LAN and the outside LAN port matches his port.
Here lies the problem, suppose I have Joe listening on port 6996, after he is NATed, his outside port is 18938(just some random open port)
Ok, wrapping up, there has to be a way to dynamically connect two peers. MSN Messenger, AOL IM for example both allow direct connections. Does anybody understand how they are doing this without opening and dedicating static ports thru NAT? They just seem to work.
Any help would be greatly appreciated. Thanks in advance.
Mike Kushner
mike@kushners.com
|
|
|
|
|
Sure. They don't care or shared IP and port information between clients. The servers that register the connections of clients do all the message passing from client to client. There is no direct connection between two clients.
|
|
|
|
|
When 2 servers are set to direct connect, no bits are passed thru the central server. MSN IM, AOL IM, etc etc etc. For example, AOL direct connect directly connects the 2 computers (Ports 375 - 425). My main question is, if these ports change on the outside of the LAN. Is there a way to detect these port mappings?
I need 2 things for the peers to connect to each other, IP & PORT. When 2 or computers on a LAN access the internet, they usually share a common IP (DHCP, Share WAN IP) or they have a direct internet connection (Single Computer or Static IP), this I can detect in either case. The port number on the other hand is somewhat difficult if there are more than one computer on the LAN. When setting up multiple computers on the LAN, I start to have problems. Single computer or static LAN IPs aren't a problem.
Here's the problem. When I set my TcpListener to start listening on some port, for example 6996, and have more than 1 client on the same LAN, their is no logical way to determine which computer is which. Take the following table for instance. I have 3 computers on 2 different LANs
Mike's Computer
LAN A
Local IP: 172.16.1.1
WAN IP: 65.42.105.105
Listening PORT: 6996
Joe's Computer
LAN B
Local IP: 169.16.1.1
WAN IP: 32.42.33.55
Local Listening PORT: 6996
WAN Listening Port: ???
Nick's Computer
LAN B
Local IP: 169.16.1.2
WAN IP: 32.42.33.55
Local Listening PORT: 6996
WAN Listening Port: ???
Given that example, how could I do the following without having to having Joe's system admin set NAT for IP 32.42.33.55 PORT 6996 to point to Joe's computer. This obviously works somehow with AOL Direct connect.
So basically, how can I log how Mike's Computer in LAN A can connect to Joe's computer in LAN B on his outside IP of 32.42.33.55 and local port 6996
Any thoughts?
Mike Kushner
mike@kushners.com
|
|
|
|
|
mkushner wrote:
Here's the problem. When I set my TcpListener to start listening on some port, for example 6996, and have more than 1 client on the same LAN, their is no logical way to determine which computer is which. Take the following table for instance. I have 3 computers on 2 different LANs
There's your problem. How is the NAT going to know which machine to forward your ports to? Without telling the NAT how to handle the connection, specifically which local machine to send which ports to, your never going to get a connection through. Most NAT's have a DMZ setting which tells it which machine to send all traffic to that doesn't match the port filters. Say you have 2 machines on the local side of your NAT. One is web server on port 80, the other is an every day workstation. The NAT's configuration knows that a request on the WAN side, port 80, should be forwarded to the local web server. A request being received on the same WAN IP address but on port 1000, for example, doesn't have a NAT rule configured for it. So, the NAT checks to see if it has a default machine configured in the DMZ. This machine will be the default local IP address to forward any traffic to that doesn't have a rule defined for it. So, the connection request is forwarded to the local IP configured in the NAT's DMZ. If this DMZ configuration is missing, the connection will be refused by the NAT.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
So, is there a way that if I have the ports just OPEN on the router that I can do somesort of dynamic port pooling?
Check this link out. http://kbserver.netgear.com/kb_web_files/n100495.asp[^]
See how AOL Direct Connect is using a port range of 375 - 425? Is this saying that AOL Direct connect uses these 50 ports for direct connections and computers somehow "Subscribe" to these open ports? Is it impossible to listen on these ports on the client computer inside the LAN without having to NAT?
Mike Kushner
Mike@Kushners.com
|
|
|
|
|
Hellow.There is way to determine when user click by Solution Window (an item)?
My code is Add-in in C#, i got delve Automtiztion model of VS.NET but not find out this thing.
Thank.
|
|
|
|
|
Hi,
i got an access database on a FTP-server.
Can anyone tell me how i can get to that database in a .net database application?
The underdog
|
|
|
|
|
First, be sure that the directory of your mdb is accessible in terms of user and directory permissions.
Then just feed DataSource property of your connection string (for OleDbConnection object) with the path of your mdb relative to the application path.
Give it a try....?
|
|
|
|
|
It was an intutition in the previous message.
I have tried it with IIS and it worked.
Oh no , you ask for only-FTP server?
|
|
|
|
|
Yes, I understand that (that's exactly what I said) and the point I was trying to make is that if you instantiate the NotifyIcon in the startup code for your service (which appears evident) then it'll only display the first time. When the window is destroyed (invariably when you log off) it doesn't get recreated because your service's startup code has already executed. Your evidence supports this assumption.
As I said, you should create a separate application to control the service. This Windows Forms application (hidden main form; just need to display the NotifyIcon ) runs when a Windows session is create to communicate and display status for the service. This is the correct and typical approach.
Otherwise, you'll need to P/Invoke several APIs to receive notification when a user logs in and re-create your NotifyIcon .
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]
|
|
|
|
|
Hi all,
I want to pass a large file across the network, so I compress them
part by part and stream them out to the other side. Can the zip support
such streaming compression ? i.e. at the sender side, the file is ziped
part by part and send out as zipped streams, and at the receiver side,
when all those zipped chunks are collected, they are unzipped back into
a single file by one unzip operation.
Thanks
|
|
|
|
|
I doubt it. The smaller the sample being zipped at a time, the less compression you can possibly hope to achieve. You're also still asking the system to send at least the same amount of info, so who cares if it got chopped up ?
Christian
I have several lifelong friends that are New Yorkers but I have always gravitated toward the weirdo's. - Richard Stringer
|
|
|
|
|
ZIP compression doesn't support streaming. Since the compression algorithm uses an index based on the contents of the ENTIRE stream it's compressing. It sounds like you're already using the best method for doing ZIP-type compression on a stream. I mean, break your stream into fragments, run the compression acrossed a single fragment, send the ZIP'd version of the fragment down the wire, then continue with this procedure on the next fragment. The receiving side will have to un-ZIP each fragment and recombine each piece into the original stream.
But, since a ZIP contains the bit stream substitution table used to compress the fragment, you'll be wasting bandwidth on sending this table for each fragment. This overhead will ultimately reduce the benefit your getting with compression.
Your best bet is to ZIP the entire file all at once, then send it using normal file transfer means. Using the fragmentation method you described, you're actually getting a smaller return for your coding investment.
|
|
|
|
|
|
I've found some examples here on putting icons in subitems of a listview. that works fine, but I don't want an icon/image in the first column, so the listview puts a gap there. Is there any way around this?
If I write code in my sleep, does that make me brilliant, or just a lazy programmer?
My articles
www.stillwaterexpress.com
BlackDice - the programmer formerly known as bdiamond
|
|
|
|
|
You may have better luck asking on the message board for one of the articles you found, the best probably being C# ListView v1.3[^] (also known as Glacial ListView).
Not only have they probably got a similar question before (and hopefully answered it), the authors of the better articles have worked extensively with the Common Controls APIs (since almost all the Windows Forms controls encapsulate the Common Controls in the BCL, and most List View variants start with the List-View common control). You could also try searching this forum as I know I've answered similar questions in the past (long ago). The article message boards are still your best bet, however.
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]
|
|
|
|