Thank you for the extra detail, I know it seems overkill, but it assures me I understand you correctly.
You need to realize email clients vary greatly in their ability to properly render compliant HTML. It's important to send content that can fail gracefully, and keep it as basic as you can stand to begin with.
I believe my first post's information is still valid, though perhaps not what you were expecting. And here's more. You can't simply grab the content and mail it due to the email rendering issues. But you will still want to grab selected content as it comes out of the loop. For instance, you don't want to email the remove button, but most everything else should be OK. I also doubt many email clients will grab external CSS files, so you will need to construct an email specific head section with inline CSS that you hope the mail client will use.
I would also suggest dynamically building an identical page on you site so you can provide a link for the recipient to follow if their email fails to render properly.
Here's an outline of code needed to implement this the way I see it. I'm surely forgetting many details, and there are surely other approaches.
Alter the wishlist template
- accumulate selected content from the loop into $content
- add a send to friend form containing email field and submit button and hidden field containing $content. Also include a hidden nonce field so no one can leverage this for spamming.
On form submit
Confirm user is logged in and nonce is valid
prepare for using the wp-mail() function
- add filters so the From: field is from the user. Remove any existing filters if necessary.(this step is sort of optional but the default could confuse the recipient)
- prepare the $headers parameter, including the user's email in the Reply-To: field and the proper content type header for html.
-add a blank copy of the email wishlist page to the database in order to have a page id for the next step.
- add in to the message content the body tag and link about what to do if the content is difficult to read.
- add in to the message content something about $user wanted to share this wishlist with you, if you do not want to receive such information in the future contact $useremail.
- add into the message content the page $content sent with the form data.
- add into the message content some footer information about your site.
- add into the message content the closing tags
- update the blank copy of the email wishlist page in the database with the actual content.
- prepare the $to parameter from the form field data
- prepare the $subject parameter
$result = wp_mail($to, $subject, $message, $headers );
- restore original From: field filters if needed.
- send page to user confirming the $result