how can a user contact another user

I think this is a rather general question. I would like to implement the
following function in my website: Users can create different listings.
Other user can click on the listing and click a contact button that
links to a contact form. Here, users can send the listing user a
message.

Does anyone know a good reference, or a tutorial for this functionality?
Or does anyone know how to program this?

Do you mean send an email? If so then have a look at the Rails Guide
on ActionMailer.

Colin

Not exactly. I don't want to send an email to a user. A user should be
able to fill out a contact form, which than goes to the listing user.
So I'm looking for a function that lets one user contact another user.
So the user goes to a users profile, looks at one of his
listing/postings. Now he would like to send the posting user an inquiry
about this posting.
The user should be able to click on a contact button, that lets him get
in contact with the listing user.
Does this make sense?