When and how is it appropriate for an undergraduate to email a professor out of the blue? This may not be appropriate for MathOverflow, as I haven't seen precedent for this type of question. But the answer is certainly of interest to me, and (I think) would be of interest to many other undergraduates. 
Often, while seeing some lecture online, or reading lecture notes from the internet, or hearing about someone who is an expert in a topic I'm interested in, I feel as though I want to email the professor in charge of whatever I'm looking at or hearing about. Usually this is about some question; these questions can range from the very technical to the very speculative. In the past, when I have mustered up enough guts to actually email the question, I've had good results (question answered, or reference given, etc.) However, every time I send a question I get the same sort of anxiety of "I have no idea what I'm doing!"
So here are my questions:


*

*When is it appropriate to email a professor (that you don't know) a question about their work? (Remember; I'm an undergraduate, so these questions have a high chance of being inane in one way or another).

*How should this email be formatted? Do I give my name in the first line? Or do I give a bit of background, ask the question, and sign my name. (The latter is what I have been doing).

*How specific should the subject line be in order to increase the chances that the email gets read?

*Should I mention anywhere in the email that I am an undergraduate?

*This one is kind of silly, but I always have trouble deciding what to do: Suppose that I've emailed a professor, and they email me back with some answer... is it appropriate to email back with just a "Thank you"? I always feel like I'm wasting their time with such a contentless email, but at the same time I do want to thank them... Actually, in general I feel as though my questions are a waste of the professor's time (probably what feeds the email anxiety)... which brings me to:

*If you happen to be a professor who has received such emails in the past; are they a waste of your time? Please be honest!


EDIT: Small new question...


*

*If you receive a response and the professor signs with their first name, are you supposed to refer to them by first name the next time you email them?


Once again, if you think this is an inappropriate question, I totally understand. But please start a thread on meta to discuss it, because I think this might be borderline, at least.
 A: The reasons I became a math professor are that I love mathematics and I love helping students.   I constantly try to elicit questions from my own students.   I would be delighted, not annoyed, to receive e-mail from a student who was sufficiently interested in something I had said or written to send me comments or questions.
A: Let me also try to answer the questions:
So here are my questions:

1.When is it appropriate to email a professor (that you don't know) a
  question about their work? (Remember;
  I'm an undergraduate, so these
  questions have a high chance of being
  inane in one way or another).

If you have a research level question about a professor's work or related to his or her field of interest it is appropriate to email.

2.How should this email be formatted? Do I give my name in the first line?
  Or do I give a bit of background, ask
  the question, and sign my name. (The
  latter is what I have been doing).

You can first introduce yourself. You may give the background to the question. Try to be clear and rather brief.

3.How specific should the subject line be in order to increase the chances
  that the email gets read?

As informative as possible, 
"A question about convex bodies", "Are there only finitely many smooth toric varieties" 
"An idea related to the Erdos-Faber-Lovasz conjecture".

4.Should I mention anywhere in the email that I am an undergraduate?

Yes. If this is a good research level question it will will be impressing and if not it will not harm.  

5.This one is kind of silly, but I always have trouble deciding what to
  do: Suppose that I've emailed a
  professor, and they email me back with
  some answer... is it appropriate to
  email back with just a "Thank you"? I
  always feel like I'm wasting their
  time with such a contentless email,
  but at the same time I do want to
  thank them... Actually, in general I
  feel as though my questions are a
  waste of the professor's time
  (probably what feeds the email
  anxiety)...

Yes. email back with "thank you".

which brings me to:
6.If you happen to be a professor who has received such emails in the past;
  are they a waste of your time? Please
  be honest! EDIT: Small new question...

I have received quite a few of emails from undergraduates. Usually it is not a waste of time.

7.If you receive a response and the professor signs with their first name,
  are you supposed to refer to them by
  first name the next time you email
  them?

No.
A: I am a graduate student, so I can only provide you the point of view of someone who has (and still does) asked vast amounts of questions to all kinds of people, both in person and by e-mail.  I think some of my experiences might be useful to you, though hopefully you will get the point of view of someone who is on the receiving end of these sorts of questions.  I don't know how best to organize my thinking on this issue, so I'll just make a list of do's and don'ts.


*

*My number one piece of advice is to not be bashful about asking questions.  I can completely understand the insecurity, but I have never once in my life had someone get upset at me for asking a question (even what turned out to be a stupid one).  The vast majority of the time, the person you ask is extremely flattered that you are interested in their work and enthusiastic that you have provided them with an opportunity to share the fruit of their sweat and tears with someone.  And you can learn things from communicating with experts that don't appear in any book.

*Be polite.  This means fully introducing yourself - I usually give my full name, current academic institution, and status (in your case, undergraduate).  You can also inform them how you stumbled upon their work.  Be sure to thank them for your time, just like you would anyone else whose help you are soliciting.  I also think it's a good idea to write a short "thank you" e-mail if you get a helpful answer.

*Be formal, but don't overdo it.  Do your best to use proper grammar and punctuation (including capitalizing letters, etc.) - this is required if you want your message to be taken seriously, and some people are very finicky about this sort of thing.  But you don't really want to sound like a lawyer either.

*Be concise.  If you have a ton of questions, pick a few that are most important (and which go most naturally together).  Write only what is necessary to enable a complete and intelligent answer - your audience probably doesn't want a huge reading project.  If you get a helpful answer, you can always write back.

*Be precise.  Whatever mathematical language you need to use, make sure you are using it correctly.  Make sure that your questions are written clearly and that they make logical sense.  You should also provide a reasonably specific title for your e-mail.

*Try to ask the right questions.  Your questions should have a clear and definite answer ("Can you explain what l-adic cohomology is?" is not a good question; "Do you know a counter-example if condition X is removed in theorem 5.2 of your book" is a good question).    Also, your questions should be appropriate for the person to whom you are writing; don't e-mail Andrew Wiles with a PDE question, and don't ask Hartshorne how to solve one of his exercises.  I think it is perfectly appropriate to ask and expert for references if you are interested in a somewhat obscure topic, but don't ask "what do you think would be a good introductory functional analysis book?"  Finally, never ask a question that requires someone to do a long computation for you.

*Make a reasonable attempt to exhaust your other resources before you e-mail someone you don't know, and briefly outline what you did (e.g. who you asked or what you read).  If you just read the Wikipedia page on gauge theory and you don't understand something, talk to people in your own department and look through some books before you e-mail Ed Witten.   Also, look around on the webpage of the professor in question for lecture notes or survey articles that they might already have written; you may find that he or she has already anticipated your question.

*Keep an open mind.  Sometimes you'll get a one line answer; sometimes you'll get a three page essay.  I think it depends more on the style of the person answering than the nature of your questions.


I hope you find this helpful!
A: I think the "when" part of the question has been well-answered, so I will only comment on formatting and style, some of which has also been addressed.
One thing I have trouble with when emailing people is keeping my emails short.  But it is much, much better, especially when emailing a busy math professor, to keep your email to one page in Pine (yes, lots of math professors still use Pine).  So introduce yourself briefly --- "I am an undergraduate at Tech U interested in XYZ" suffices. Using formatting, like bulleted and numbered lists if you have more than a unique question, never hurts.
At least at first, the other important thing to do is be "academic professional".  My rule when emailing anybody is to use their full name in the "Dear So-and-so", where "full name" means whatever's at the top of their academic website.  Depending on the context, honorifics like Prof. and Dr. are more or less appropriate.  I sign my emails with my first name, and then include a very short "sig file" with my full name, institution, and email address, and only the first time.  For future correspondence, I'll use whatever name the person writing to me uses in their signature. 
A: Above answers give a precise description of what the email should look like, so just a general comment. 
Profs are (usually) normal people, the fact they're higher in the academic hierarchy than 
you doesn't mean that they're some kind of semi-gods who smite mortals for wasting their 
time :). So the rules are the same as in any standard interpersonal communication (be polite and clear, use common sense, thank the person for his time etc.), the fact that somebody is a tenured professor doesn't make them a distinct kind of being that requires a special procedure. People are almost always very helpful (either because they're friendly or just flattered, it doesn't matter), the worst than can happen is not getting an answer, and even then it's usually because of lack of time. Even is prof gets annoyed by your poorly phrased email, he simply deletes it and won't take revenge ;).
The above might be obvious, but sometimes in our academic culture too much emphasis is placed on people's social/academic positions (with tenured professor elevated to some sort of semi-godlike being), which results in undergrads being scared or too shy to ask. Profs are more busy and knowledgeable, but other than that begin a prof doesn't, IMHO, entitle you to any special kind of respect (other than standard respect you should have for any person on any academic level).
Last point - it's always OK to ask, even stupid questions. Yes, you'll make a fool of yourself, but: a) the feeling only lasts for a while, b) I guess nobody will remember it (or think of you as "the one who always asks dumb questions"). It's better to be a fool for a while than to feign understanding and remain a fool. 
Also : http://www.phdcomics.com/comics.php?f=1047 :)
A: Andrew Stacey covered this briefly, but I want to re-emphasize:
If you are an undergraduate it is unlikely that you have questions that actually require asking the expert in something.  If you're at an institution with a graduate program (this may be different at a liberal arts college) you ought to be able to find someone local you can ask instead.  This way you can talk in person (which is an easier way to communicate), you can ask during someone's office hours (when they're in their office answering questions anyway), and you're building connections with professors at your school who might write you letters in the future.
Furthermore, if the professor you ask locally doesn't know the answer, they'll be able to point you to a friend of theirs who will know the answer.  That way you can start your letter "Hi, I'm a student at school X and Prof. Y suggested you might know the answer to the following question."
In graduate school things are a bit different, you're more likely to have a question that really does need to be asked of a particular person, and you're more likely to know whether the question is a good use of that person's time.  Furthermore, as a graduate student you'll want to start getting to know the experts in your field at different schools.  So, if your advisor doesn't know the answer to a question you shouldn't hesitate to email someone who you think would know the answer.
A: It may be helpful to read the perspective of someone reasonably senior (alas!), so here it goes.
Although I do not remember getting emails from undergraduates, I do get occasional emails from PGs, postdocs and other researchers in my community whom I have never met or heard from before.  If the message is addressed to me and is clearly not spam, then I will invariably respond, if only because I think it polite to do so.  However the type of response can depend on a number of factors.
For me to truly engage with the email, it has to satisfy a number of criteria.  First of all, it should be clear that the message is serious, that the sender has done her/his homework, and that the tone is polite without necessarily being too formal.  It helps to feel that I am "uniquely" (whatever that means) qualified to answer the question.  Usually this means that question refers to something I have written.
If I know that the question is answered in the literature, I will point to the relevant sources with some commentary and perhaps a short guide to the literature.  On the rare occasions I cannot get away with that, I will send a detailed answer.
It's nice to receive an acknowledgment of receipt, if only to say 'Thanks'.  I almost always sign my emails with my first name, and hence I will not get offended if the next email is addressed to me in that way.
I prefer plain text email to HTML, institutional email addresses to sophomoric_name@hotmail.com, and I'm more likely to take seriously emails which are succinct, carefully punctuated, and have correct spelling and grammar.
And of course it is important to know at which stage in their career the sender finds her/himself, if only to know at which level to pitch the response.
A: I have contacted many professors as an undergrad. It helps if you have had some contact with them during coursework/tutorials. But it is certainly not a necessary condition.
The most important thing to remember is that Professors are people, too! They want to help undergraduates learn. They want to guide their education in whatever way they can. That is one of the main motivating factors in an often solitary academic landscape - the belief that their knowledge is being put to good use.
A: This is a very good question and the previous answers covered most of what I would have liked to say. So the only point I would like to add is that there is a huge difference in how busy professors are. So for instance I would be happy to receive an intelligent question related to my work. However, there are some well known people who are presumably bombarded with emails and I am sure a lot of these emails are very reasonable emails. So I would avoid writing to such people unless I exhausted all other possibilities first and I am also sure that what I am writing will interest them. If I have doubts, I will not write them.
A: My experience from asking questions by email is that friendly, short and clear questions are usually answered in a similar way. Once, a friend from the Studienstiftung whose way to ask is more formal, like the descriptions above, and I made an experiment: The short and less formal mails work much better. Status etc. are the more irrelevant the brighter the receiver is, good brains obviously are good communicators too. Of course I try not to ask questions which sound to me as if they could be an exercise or answerable by a web- resp. library search. Occasionally, some people are a bit mad and, when asked by a stranger, suspect conspiracies by competitors under a pseudonym, or get an ego problem if noticing that their articles are readable even by non-specialists, but such cases are much rarer among mathematicians than among e.g. philologists. Conc. "If you receive a response and the professor signs with their first name": If it's a professor in England, don't refer to him by his first name in your next mail. If it's a professor in the US, you can switch to the first name. 
Edit (on the comment below):
It would be great if sociologists do some email-experiments on that. My experience is that mathematicians are far better and quicker in answering email-requests from "outsiders" (e.g. I never use a university-email account) and among mathematicians, the more known one's reactions often are faster and more extensive than that of others, despite they probably receive a lot of such mails. Even when the request was about some outdated issue, one often receives links, texts and suggestions directing to (in their view) more interesting, open, in any case very stimulating themes. However, "communicative skills" exist in different ways, e.g. here a mathematician's collection of personality tests, who thinks that email-communication fits well to the specifics of high functioning autism, which probably is overrepresented among mathematicians.               
A: Whenever I write to a professor or researcher who I don't know in person, I make sure to write a formal letter.  For the first letter, I introduce myself briefly (I'm an undergraduate at university of michigan, my research interests are mainly higher category theory, categorical homotopy theory, and commutative algebra, etc.) (just don't make it too long) and explain why I'm writing him or her.  I make sure that I've done my homework (see the MO FAQ/howtoask page) and explain why I'm writing (oftentimes, it's that nobody in the department is working on the things I'm trying to learn, so it's very hard for me to just ask for some help in person).  
I make sure that the recipient knows that I understand that he or she is probably very busy, and that I really appreciate him or her taking the time to read my e-mail.  Then I ask the questions I'd like to ask.  I think it's best to keep all of your communication very formal until you've met in person.  The professor/researcher you're emailing is doing you a big favor by explaining a point that is probably trivial in the grand scheme of things.  
I don't know if these are necessarily always the right things to do, but I've always gotten a good response by doing it this way.  Most professors and researchers seem to be very happy that you're reading their work, and as long as you're not annoying them, they seem pretty happy to discuss it.  
A: (I'm in a mellow mood - plus one benefit from MathOverflow is that I have gotten a few emails from people "out of the blue" that I wouldn't have gotten otherwise - so I'll have a shot at answering.)

*

*When the question really is about their work.  It's very easy to ask a question that isn't about their actual work - for example, if there's a bit that you don't understand then it might be a core bit of the work (in which case, it's okay to send the email) but your confusion might be based on a misunderstanding of something more basic (in which case, don't).  To figure out the difference (as that's not always easy), ask someone nearby (ie someone in your university who is therefore paid for answering your questions, allegedly) who's in a similar area.  If they can answer your question, great.  If not, send the email.
The situation is slightly different if the question arises from some lectures.  Unless they are very specialised lectures, it is unlikely to be directly related to the person's work.


*Same as any other email would be.  Explain how the question arose (you were reading their work - flattery will get you a long way), what the question is, then explain what your background is so that they will know how best to frame their answer.  Also, try to make it possible for them to answer your question with the minimum effort possible.  Remember: you are asking someone to help you who isn't paid to do it.  They will probably want to help you, but make it easy on them.  So "can you give me some references where I could find out more" is better than "can you tell me more".  The first still allows the person to give more details if they feel so inclined, but also shows that you recognise that it is a bit of an imposition to ask.


*Very.  But remember that many email programs truncate the subject line (often hilariously) so: "Question about arXiv:0822.2225" or something like that.


*Absolutely!  I would view this as already being "on the inside" so I'm more inclined to help, and it tells the person a bit about your background so they know what to assume or not to assume in their reply.


*Absolutely.  Profs are human too (so I'm told).  "Thank you for your help" can make someone's day.


*Not actually a professor, but I'll answer anyway!  No, such emails are not a waste of my time.  I'll admit that I don't tend to get many from undergraduates from other institutions, but I do get a few from graduates.  Getting such an email is nice because it tells me that there are other people thinking about similar things to me, and so that my work isn't being completely ignored (it's often hard to tell that otherwise).  Particularly, after a day answering banal questions on MO (okay, exaggeration for effect), it's nice to get a question that is actually about something that I'm (supposed to be) an expert on.
That said, don't flood people with questions!  Try to remember that such questions are similar to MO - you're asking someone to do you a favour with no real hope of return.  Most people are nice and will do their best to help, but make it easy for them to do so.  The MO FAQ is a good thing to read: if it would make a good MO question, but you happen to know exactly who's the right person to answer it, you could send them the question (possibly with posting on MO as well?  And if they're known to use MO, why not post the question here and send them an email simply saying "I asked this question and I wanted to bring it to your attention as I suspect you'd be the best at answering it.".  Bit of flattery, plus as it's on MO, if the person really is too busy then they don't feel too guilty if they can't answer it since someone else will probably have a go.  Making it easy again.).
A: Dylan, this is a very good question, and you got really excellent advice. I have received emails from (Italian) undergraduates and graduate students asking me how to solve random exercises; furthermore, it was obvious to me that they were not just emailing me, but several other people. They did not even write my name in full, their emails would start with something like "Hello!". These are really irritating; I write to them to point out how inappropriate their behavior is, but they never seem to get it. The last one (who was completely unknown to me) replied that "being a teacher is a vocation", reproaching me for not being very happy help her solve her linear algebra problem.
Now, obviously you would not do this. Let's assume you are writing to me. I always try reply to thoughtful questions related to my work, or to something I wrote, or to something I am expert in (as an example, don't email me with questions about group theory: if they are hard I won't be able to answer, if they are easy I will seriously wonder why you can't ask one or your teachers, or someone else closer to you). I make exceptions for students from the third world.
Introducing yourself is good, but don't make it too long. The way you have been doing it is fine. Try not to be long-winded, but give all the essential details (of course, this is not easy for someone who is not experienced, so you will get plenty of leeway from me). Also, give me some idea of your background, so that I know what kind of knowledge I can assume.
If your question is very easy and not very interesting to me, expect a concise answer: if after thinking about it you still don't get it, you should feel free to write back, explaining to me more precisely what your problem is (I mean, simply repeating the question won't do, but something like "I tried what you suggested, I can see that $X \to Y$ is smooth, but since the map $U \to V$ is not a pullback of $X \to Y$ I don't see why this implies that $U \to V$ is smooth" will work). If you manage to ask an interesting questions, so much the better, and you will get a more extensive answer, and impress me as a bonus (you never know when having impressed someone might be useful).
I very strongly advise thanking afterwards. It is polite, and creates good will. I find the idea of spending time writing an answer that is not even acknowledged very unpleasant. If you don't thank me, you are much less likely to get a reply the second time.
I always sign with my first name, and don't mind it all if you use in subsequent emails (as a matter, I prefer it, but if you feel uneasy doing this then don't, that's fine too).
Don't be shy. Spend time thinking about what you are writing, but keep in mind that you won't be held to the standards of professionals mathematicians. In any case, the worst that can happen is that you don't get a reply.
A: First of all, MathOverflow gives you a great glimpse of how and when to ask mathematicians questions.  This site has a fair mix of professors, postdocs, and graduate students, along with a few others.  So as I think you can see, most mathematicians (maybe not quite all) like to answer questions.  The only real issue is to write the question so that the recipient will enjoy answering it.
Yes, you should introduce yourself and be polite.  However, only in an efficient, common sense way.  I for one really don't like toe-kissing and self-deprecation before a math question.  It can be worse than rude, cryptic e-mail with no introduction.  Here is an example of a turn-off introduction...

(1) Hi, I'm just a lowly undergraduate and (2) I'm not very good at math.  (3) I'm sure that you are really busy and that (4) this is a stupid question.  (5) What does it mean to have a manifold such that..."

...annotated with my private reaction:


*

*I'm not that elitist; at least, I hope not.

*People who like math do not enjoy such disclaimers.

*Actually, I struggle with procrastination just like most people.

*Is that meant as a warning?

*Finally, something that I might enjoy reading.


What is important, as you can see from MO and as Jose says, is to put some thought into the question, and to have a reason to ask Professor X and not someone else.  I don't think that you should belabor either issue; brevity helps with both clear prose and good manners.  Although I basically agree with Jose, I don't know that you have to be all that super-serious.  What is bad is when you want someone else to think harder about a question than you did.  I'll never forget this bizarre verbal question that I once got from an undergraduate, although in fairness it was an innocent and temporary mistake on his part:

Him: Can a prime have a non-trivial?
  Me: I'm totally lost.
  Him: I'm taking abstract algebra.
  Me: Do you mean then, a cyclic group of prime order?
  Him: Yes, exactly.  Can it have a non-trivial?  I think that it can't, but I'm not sure.
  Me: I'm still lost.  Prime cyclic groups are non-trivial in a lot of ways.
  Him: (surprised) So it can have a non-trivial?
  Me: No, I mean, a non-trivial WHAT?
  Him: Oh! A non-trivial SUBGROUP!
  Me: Then you're right, a prime cyclic group has no non-trivial subgroup.  

(I was not teaching algebra at the time, so this was really out of the blue.)  Anyway, the point is that it's important to ask a question properly.
As for the second issue, why ask X instead of Y, there are several ways to score a direct hit:  e.g., if the question comes from X's paper, or if you mention that Y referred you to X.  But I don't know that it has to be a direct hit to be a reasonable e-mail question.
Maybe a bare thank you response with no other content is a bit thin.  You're right that it's good to thank people.  What you can do in a thank-you response is to say something about how well you understand the answer or how you plan to use it.  Possibly a bare "Thanks!" could come across as dismissive, although this is not usually a serious concern.
A: EDIT, Thursday. Maybe someone has mentioned this idea. I have, often enough, typeset the letter I have in mind in Latex letter document style. Then I send the email with my best ordinary text version of that, but point out that I have also attached a more readable pdf. I sent you a sample a few minutes ago. $$ $$ 
ORIGINAL:Let me expand on a single point of Andrew Stacey, about not flooding people with questions. I have been on both sides of that one. Other people have bombarded me with questions, and this has led to some joint papers. In the other direction, I asked too many things of one guy, and eventually got a very polite but clear message to leave him alone. So, especially as an undergraduate, you need to bear in mind the possibility that the reply may not be enough ("Oh, that is covered by my 1000 page article somewhere") but a second email might nevertheless not be welcome. Or a fourth email might not be welcome after three went quite well. With any luck, it will be possible to decipher the professor's emotional response to your correspondence. That caution being said, I can't say anyone has reacted badly to a first message from me, just sometimes there has been no answer. Anyway, you can always write to me.
