|
hi,i want to send an email,containing embedded images.i have written a code for it and that's what i have written--
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.IO;
using System.Net.Mail;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void btnSubmit_Click(object sender, EventArgs e)
{
string fileName = FileUploadReciepent.PostedFile.FileName;
fileName = fileName.Substring(fileName.LastIndexOf('\\') + 1);
string filePath = Server.MapPath(".") + fileName;
FileUploadReciepent.PostedFile.SaveAs(filePath);
ExcelReader reader = new ExcelReader(filePath); //Create an Excel file Reader
reader.setCurrentWorksheet(1); //Set current worksheet as 1
Array al = reader.getRange("A1", "A3"); //Get A1 to A3 from worksheet 1
foreach (object cell in al) //Loop through all the cells
{
TxtTo.Text += cell + ",";
MailMessage message = new MailMessage();
message.From = new MailAddress(txtName.Text);
message.To.Add(TxtReceipent.Text);
message.Subject = txtsubject.Text;
message.IsBodyHtml = true;
message.Body = Literal1.Text;
LinkedResource image = new LinkedResource("C:\\My Documents\\My Pictures\\anything.jpg");
image.ContentId = "anything";
//add the LinkedResource to the appropriate view
//htmlView.LinkedResources.Add(image);
SmtpClient client = new SmtpClient("smtp.xxx.com");
client.Host = "xxx.xxx.xxx.xxx";
client.Send(message);
}
}
protected void BtnUpload_Click(object sender, EventArgs e)
{
TextReader a = new StreamReader(FileUploadContent.FileContent);
Literal1.Text = a.ReadToEnd();
}
}
FileUploadReciepent-file upload control that gets all the email ida from my excel sheet.
fileUploadContent-uploads the html content,with embedded image from my system.
I have searched all over the internet,but couldnt find any solution.hope u'll help me finding One!!!!!!
this code works fine for outlook.but in gmail or yahoo,i cant c the picture.please help me where i am wrong.???
can u tell me the code please...its kind of important for my project
|
|
|
|
|
Varun123 wrote: LinkedResource image = new LinkedResource("C:\\My Documents\\My Pictures\\anything.jpg");
You need to do some serious study, you are missing some very basic things. Outlook can access your file system. Can the person on the other end who gets this email, even if they have outlook, access your local file system ? Didn't I tell you earlier today - the image needs to be hosted on the web.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
i know that..but its also true that while sending embedded mails thru outlook also,the person on other system is able to view that image.how is that possible.???????i need to know only this thing...
|
|
|
|
|
hai, how do execute the textbox script value at dynamically in .net with c#
.if know the answer replay to me....
|
|
|
|
|
This question has nothing to do with ASP.NET. you posted in the right forum, don't post here, too
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Does anyone know how to prevent the page from going to the beggining after a selection is made on the rating control?
Its kind of weird, really weird
It also happens on the official site of the ajaxtoolkit samples
Thanks in advance
Alexei Rodriguez
|
|
|
|
|
How to authenticate the user name and password in real time not using Login controls given in VS 2005?
and how to assign roles dynamically(i am using forms authentication)?In real time do we use Login controls given by VS 2005 or do we need to create DB for login and retrieve values from DB and compare the login values with DB?
Thanks
|
|
|
|
|
dotnetprogrammer1984 wrote: How to authenticate the user name and password in real time not using Login controls given in VS 2005?
By writing code that checks them against your own membership system, probably a database. That seems obvious to me, is this really what you meant to ask ?
dotnetprogrammer1984 wrote: how to assign roles dynamically
Depends, how do you want to assign them ? I mean, you have control over your role system, on what basis do you want to assign them dynamically ?
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Hi there
I saw in directories that they display a category and its subs in links like
* Agriculture (258)
Agriculture & By-product Agents , Animal Fodders , Beans , Dried Fruits , .....
* Apparel (85)
Accessories , Athletic Wear , Children Garment , Footwear , Leisure Wear , .....
and all is links
how could i do this in asp.net 2.0 using VS 2005
Could any one help me please ?
|
|
|
|
|
A repeater is the obvious way to get this data from the database and bind to it so it shows in the format you're hoping for.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Thank you very much for answering .
but iam not that familiar with the repeater and all the tutorials i have found dosent give me what i want .
could you please give me example on this case ?
|
|
|
|
|
Just create a repeater where each item is a link and where there's no break or anything else to create a new line. The data source would be a collection of objects that provides the text for the item, and hte link that the item goes to.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Hello,
using a dropdownlist I want to change the user interface language (resource files). The approach was supposed to work as follows:
1) Autopostback dropdownlist with language entries.
2) As soon as the selected index of the dropdownlist changes, the new language entry shall be stored in a session variable session["uiculture"].
3) Within InitCulture() the new language shall be set as follows
Thread.CurrentThread.CurrentCulture = new CultureInfo(session["uiculture"]);
Thread.CurrentThread.CurrentUICulture = new CultureInfo(session["uiculture"]);
However, the approach does not work. The language being set lags behind. It is only with the following postback that the language is being set - too late. So it seems like InitCulture() is being invoked prior to the selectedindex_changed(object sender, eventargs e) event handler.
How can I solve the problem?
Many thanks in advance!
Cheers,
Goebel
|
|
|
|
|
What would happen if you redirect the user to the same page after you set the uiculture in the session?
The user wouldnt notice it
I know this would cause 2 requests, but if it works, you can use it meanwhile
Or you could use server.transfer
Alexei Rodriguez
|
|
|
|
|
Thanks dude, that worked fine!
Cheers,
Goebel
|
|
|
|
|
If you are not using querystring parameters on this page, id recomend you to use server.transfer instead of response.redirect
Alexei Rodriguez
|
|
|
|
|
Hi, thanks for looking
Im inheriting a page from another page (commonpage)
In my commonpage im just making sure that session hasnt expired before forms authentication ticket (Only in forms that need the user to be logged in)
In the load of commonpage i have:
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Val(Session("UserID")) = 0 Then
FormsAuthentication.SignOut()
FormsAuthentication.RedirectToLoginPage()
End If
End Sub
In the pages that inherit from this common page, i also handle the load event, wich gives me an error, and i have to declare it overloads
Then i need to include a call to the base load
Protected Overloads Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
MyBase.Page_Load(Me, New System.EventArgs)
'do something else
End Sub
Do i have to alwasy include a call to the load event of the base class or is there any other way to inplicitly call the load event of the base class?
Thanks in advance
Any other approaches are welcome
Alexei Rodriguez
|
|
|
|
|
You do need to call the base method explicitly, that's for sure. Not sure why you need to do 'overloads', but I don't do VB.NET.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
I am creating a Mail site.i have a third party smtp server, for sending emails in not an issue but how do i read a received mail in my smtp server.
coolsatty
|
|
|
|
|
Write a mail reading program. There's no automatic way to get them.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Hi, I know how to use Resource file to get the text and assign to server control; i.e. <%$ Resources:filename, key%>.
I have created resource file with keys:
Key value
-----------------
txtFirst => First
txtName => Name
txtLast => Last
In the DataGrid header i want to display "First Name", i.e. 2 resourse strings in single header.
Is there anybody who knows to access multiple resource strings in designer by using <%$ %>? not programatically.
Thanks
Regards
Aftab Sindhi
.NET Application Developer
U.A.E
|
|
|
|
|
I have a path of images in stored in a database now i want to show these images in gridview(or some thing like that) horizontally each row containing 5 images and if possible something about images below it the image should link to another page, how can i do this please help i got this working vertically( if the retrieving from database is done in codebehind its better) thank you.
Any help will highly appreciated
|
|
|
|
|
Two options
1 - get your datasource to return data in five columns
2 - use a repeater to get more control over how your data is shown
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Use a datalist and Set the RepeatColumns property to 5
Create a template for the datalist with:
One imageControl binded to the image path
One optionally Hyperlink binded to an ID and with a format of something like: Page2.aspx?ID={0}
Alexei Rodriguez
|
|
|
|
|
m stuck up with the code for online quiz.. i would like to get the code for online quiz in asp.net and vb
|
|
|
|