473,666 Members | 2,337 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Add string as attachment

Hello,
this is my first post here..

I'm writing app where I need to send TextBox content as attachment.

typical attachment construction is like:

mail = new MailMessage()

mail.Attachment .Add(@"C:\fileT oAdd.txt");
instead I need somethin like this:

string attachmentName = "att1.txt";
string attachmentConte nt = "1234945866 ";

How add string "attachmentCone nt" as attachment with "attachmentName "
as attachment name.
Google is no help :(

Sep 27 '06 #1
2 1516
You probably need to take your string and save it as a file.
Usually attachments are files. So using the StreamWriter class you can
save some text as a file and then attach that file.

Sep 27 '06 #2

Steven Nagy napisal(a):
You probably need to take your string and save it as a file.
Usually attachments are files. So using the StreamWriter class you can
save some text as a file and then attach that file.
I'm aware of such solution but file name is easy to guess and I'm
afraid some security risk - someone can inject data to file betwen
creaton and sending it - cousing bad things :(
Data from file are security keys and I dont want to write them anywere
on PC where applicacion will be working - only person who inserting
data should now it.
I now that I can write and delete file but there is moment where file
is on disk...
That's why I'm looking how to send string as attachments.

Sep 28 '06 #3

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

Similar topics

4
26706
by: Wald | last post by:
Hello group, I've got a script here that sends emails with an attachment to an email address that is retrieved from an html form. The email sending code is include below. The problem: when sending the email to certain email servers, the attachment section of the email gets removed and I end up with an attachment of zero kb. Other servers do accept the attachment as expected.
1
3524
by: abracad | last post by:
I'd like to add a form that will email a file attachment to me. Can anyone recommend a decent free script? Thanks
2
3183
by: knoak | last post by:
Hi there, I've found a script at these great Google fora. a script to send emails with attachments. The script is below this message, name etc. aren't mine, but from the original post. My questions are: - Is this script extra heavy for a server, or should it be no problem?
0
1332
by: David | last post by:
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
6
2152
by: Piotr Wójcicki | last post by:
Is there any way of sending email with attachment created from string ? I dont want to save this string as Text file on hard drive. Thank you Piotr Wójcicki
1
1348
by: bhavik | last post by:
hi I have problem with attachment showing form server side. when our application run on localhost we add any attachment to mail server. if suppose we want to show that attachment we can see that attachment with View button. so in view button I me giving path of local machine and attachment will be showing. but..... when I upload that application on server machine and when I click
9
3952
by: c_beginner | last post by:
Dear group, I want to implement a solution to the following link: http://acmicpc-live-archive.uva.es/nuevoportal/data/p2006.pdf As a beginning I am trying to implement this little sample program which will delete the repeated strings in two set of strings.
3
4967
by: TomislaW | last post by:
I am sending word document with e-mail from asp.net 2.0 application. I read doc file like this:FileStream fs = System.IO.File.Open(docPath,FileMode.Open,FileAccess.Read,FileShare.Read); Then create message: MailMessage message = new MailMessage("mail@company.com", email); message.Subject = "Subject"; message.Body = ""; ContentType ct = new ContentType("application/vnd.ms-word"); Attachment data = new Attachment(ms,ct);
9
4218
by: deepaks85 | last post by:
Dear Sir, I have created a simple request form which will be mailed to me. Now I want to attach files and send it through that request form. For this I am using the following script: <?php function mail_attachment ($from , $to, $subject, $message, $attachment){
0
8440
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8352
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
8549
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8636
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7378
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6189
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5661
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4358
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2005
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.