Extracting UID information from a URL and sending email to this user As a beginner, I would be grateful if this community could help me out to solve the following problem, by giving me some pointers.
This is the scenario I would like to implement in Drupal (I guess I need to create my own module):

A user (“U1”) enters a URL which looks like this:
www.mywebsite/Foo/UID2
Note that U1 does not need to be registered on my web site ( = anonymous), although he / she may be, to access the page which will be invoked through this URL.

U1 is then automatically redirected to a web form page where he / she will enter text: “Hello my name is Bob…”, an email address: “u1@example.com, a phone number “123 345 67 89”.

An email containing this information will be sent to the user that has UID2 as his / her user ID. U1 will not see U2’s email address.

The information that U1 sent an email to U2 will be kept in a “from-to” table which manages the following information:

UID_from (if it exists) 
U_from First Name
U_from Last name
Text_from
Email_from
Telephone_from
UID_to (note: this UDI always belongs to a registered user)
Date &amp; time

Can someone give me some indications of the various functions invoked? If a ready-made module exists (which I did not find), the better.

I suspect hook_menu will be used; but how to extract UI2 from the URL and send it to a web form, which later is handled by an email module?

Thanks so much,

Peter
You can solve your problem using Out of the box Webform Module. 


  Webform is the module for making surveys in Drupal. After a
  submission, users may be sent an e-mail "receipt" as well as sending a
  notification to administrators. Results can be exported into Excel or
  other spreadsheet applications. Webform also provides some basic
  statistical review and has and extensive API for expanding its
  features.



You can read uid value from URL .. Webform has support for tokens. You need to create a field to collect UID and configure default value.


For Example:
%get[key] - Tokens may be populated from the URL by creating URLs of the form http://example.com/my-form?foo=bar. Using the token %get[foo] would print "bar".


Your URL should be http://example.com/my-form?uid=value .. You will configure default value as %get[uid]
Webform has Email support out of the box.
You can see user submitted results in webform you created.
It automatically creates schema for you, and it has lot more features...