The web site is on online library where the user finds a book and sends an email to the owner of the book.

My PHP creates a table of results based upon a query. One of the cells in the table includes an email link to the owner of the book. Clicking on the link opens up the user's email program with an email mostly filled in. (To, Subject,and most of the Body) The user adds a bit more to the message and then sends the email with his request.

This all works perfectly. The pertinent code is:

$body = "\nMedia: ".$row[1].",  titled "".$title.""";
  if ($by<>"") {$body = $body." and authored by &quot;".$author."&quot;";}
  $body = $body."%0A&nbsp;%0A".$row[9]."&nbsp;".$row[11];

  echo '<td colspan=2><a href="';
  echo 'mailto:'.$row[10].'?subject=Online Library-Item Request&body='.$body;
  echo '">Contact Owner</td>

I would like to add some <i>style</i> to the actual email letter - just bold and italics. For example, putting the Title in bold and the Author in Italics.

Sending email with style from PHP is discussed on the web, but not creating a link that will create an email message in the users email program.

Member Avatar
diafol

creating a link that will create an email message in the users email program

What does this mean? User's email program? Are you talking about sending the email to an address?

Each visitor to the web site also has an email program (Outlook, Firefox, etc.) on their computer. Clicking on the web site's link opens up that email program and fills in a email letter. The user adds some more info to the letter and then <Sends> the email.

Each book owner in the on-line library has different rules and tasks they are willing to perform (info look-up, how long they are willing to loan the book, etc.). The MySQL db holds different instructions from each book owner and includes those instructions in the email letter. Of course the letter also includes the name of the book and other info retrieved from the DB.

Setting up a meeting time and place between the owner and the user will take some back and forth email. I feel it's best to start that process immediately with the initial communication between the two using the borrower's email program - rather than an online form that is sent from the web site to the owner.

Member Avatar
diafol

So your website takes control of an user's email client when they click a link? Eek. I don't think I'd like that. I don't know if this is possible even, unless you use COM. BTW Firefox isn't an e-mail client.

na its just an <a href='mailto ..... link, most people use a php mailer, even from one user to another, so they can keep a record of what is sent
great way to gather addresses for later mailouts

the standard for mailto allows the link to fill in certain defaults in the mail, add some text to the body
to include the tags in the link use the relevant html entity
< as &lt;
> as %gt;
there is bound to be a table of html entities somewhere easy to google and authored by &lt;i&gt;&quot;".$author."&quot;&lt;/i&gt;";}

commented: gotcha AB. Couldn't work out what the hell he was getting at +13

Good link arday...that's exactly what I'm doing, and it meets my needs perfectly.

AB, the &lt;i&gt;&quot; technique puts <i> and </i> in the body of the message, but the message isn't treated as HTML. I think I must have to include the entire Head and <Body> etc. coding, of course using &lt; instead of <

For example:
<html>
<body>
My message goes in here
</body>
</html>

Everything I've read about this approach for PHP uses Mail(). More importantly, they stress the need for a Header to include something like:
$headers .= "Content-type: text/html\r\n";

That's the part I'm now concerned about.

Where would I put that header info using a mailto link?

That must be the reason why everyone uses some kind of form mailer, to be able to easily html it

Member Avatar
diafol

Agree with AB. Mailforms or form mailers are much easier to deal with. You can set them up so that the sender receives a message as well if they enter their email address. You can use a simple WYSIWYG editor to create your html messages if you really have to have html.

However, these can be used to send crud, so protect them with a captcha or similar.