you can use PHP to do all of this.
PHP has a mail function that sends mail using SMTP, (all you'll need is to define a relay server, -which can be on the same box as the website).
from here you can set up a form with from/to/subject/message fields and a send button that calls the mail processing script in PHP.
But to save re-inventing the wheel you should probably search for some PHP mail scripts, there are some really good ones already made that look pretty good and also include the ability to attach files in the correct mime encoding etc,
just google for 'php html mail script' and there are a load of results.
that'll let you keep everything quite nicely on one box.