473,405 Members | 2,354 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

How to convert a String to Tiff from a POP3 message

I have a C# application that functions as follows:

1. Log onto a pop3 mail account
2. search for any messages from a given source.
3. Get the attachment from the message. (This attachment will ALWAYS
be a TIFF file).
4. store new tiff file on local server.

I have everything working except the file I save cannot be viewed.
I'm sure its because of the formating of the string I store in the
file.

I need help converting the string to the correct format before storing
into a TIF file.

Following is the current code snippet.

startPos = msgStr.IndexOf("attachment;",0);

if( startPos != -1 )
{
startPos = msgStr.IndexOf("filename=",startPos);
startPos = startPos + 10;
endPos = msgStr.IndexOf("\r\n",startPos);
Console.WriteLine ("You have an attachment: " +
msgStr.Substring(startPos, endPos - startPos - 1));

//this will create the new file
strFileName = @"c:\temp\" + msgStr.Substring(startPos, endPos -
startPos - 1);
FileStream fs = File.OpenWrite(strFileName);
byte[] by = System.Text.Encoding.ASCII.GetBytes(msgStr.Substri ng(endPos
+ 1).ToString());

fs.Write(by,0,by.Length);
fs.Close();
}
else
{
Console.WriteLine ("No attachement.");
}
Nov 15 '05 #1
0 1319

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Dominic | last post by:
Hi guys, In .NET, how can I convert a HTML file to TIFF efficiently? One possible way is that I can first use word automatation to load the HTML up and then print it to TIFF. Is that right?...
5
by: Dominic | last post by:
Hi guys, In .NET, how can I convert a HTML file to TIFF efficiently? One possible way is that I can first use word automatation to load the HTML up and then print it to TIFF. Is that right?...
1
by: Daniel | last post by:
I have looked everywhere on the web for an answer to this and the only thing I can find is converting the image format when the file is present on the local filesystem. What I want to do is use a...
4
by: Dominic | last post by:
Hi guys, In .NET, how can I convert a HTML file to TIFF efficiently? One possible way is that I can first use word automatation to load the HTML up and then print it to TIFF. Is that right?...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.