473,396 Members | 1,921 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,396 software developers and data experts.

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:\fileToAdd.txt");
instead I need somethin like this:

string attachmentName = "att1.txt";
string attachmentContent = "1234945866";

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

Sep 27 '06 #1
2 1505
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
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...
1
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
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...
0
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...
6
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
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...
9
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...
3
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...
9
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: ...
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
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...
0
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,...

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.