Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I'd like to implement an email icon on the pages of our SharePoint 2010 site collection; when the user clicks it, a Lightbox-style popup allows the user to email the current URL with a custom message to someone.

It would be great to have fields for the sender's name ("Alex" for example) and a field for the body of the message that has the page's title. This might require jQuery. Has anyone done something like this? Thanks.

share|improve this question
add comment

2 Answers 2

up vote 2 down vote accepted

You can develop application page and 'pop it up' by using Dialog framework on button/icon/link click event you included in masterpage (or where you need it).

In application page you add textbox for body and on PageLoad you set it's default value (current page URL):

  protected override void OnLoad(EventArgs e)
  {
     base.OnLoad(e);
     textBoxBody.Text = System.Web.HttpContext.Current.Request.Url;
  }

You also add textboxes for mail address of recipient and subject (if needed) as well as additional Send button:

 <asp:button ID="SendMail" runat="server" Text="Send" OnClick="SendUrlinMail" />

And in application page code behind:

 protected void SendUrlinMail(object sender, EventArgs e)
 {
    SPUtility.SendEmail(SPContext.Current.Web, false, false, 
             textBoxTo.text, textBoxSubject.text, textBoxBody.Text);
 }

Since you are using SPContext.Current.Web from field of your message will be current users mail (if exist) - this is something I can only verify by experience (!)

This is simplest solution I can think of. Sry - no jQuery :)

share|improve this answer
add comment

You can do this with a feature and a custom action.

I found something like what you need here:

http://stackoverflow.com/questions/1139873/can-i-easily-add-a-send-to-friend-or-email-this-feature-to-a-sharepoint-list

share|improve this answer
1  
+1 because you are linking answer provided by our moderator :) but this is 2007 solution! –  Vedran Rasol Sep 29 '11 at 8:37
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.