Here's a handful of issues:
- You forgot to include "To:" in front of the recipient's address.
- You forgot to include a line break after the recipient address.
- You do not check whether $name, $mail and $text contain line-breaks. You must make sure that they do not - otherwise your script has just become a spam gateway.
- You include a double line-break after the "Content-Type" header which means that all the subsequent headers will be treated as body text, not headers.
- Once you've corrected the Content-Type problem, your generated e-mail does not contain any body text. This may cause problems for some mail transfer agents. As a minimum, include a couple of line breaks after the subject line.
... seriously, just use a pre-written script, such as the NMS one that people have pointed you towards.
perl -E'sub Monkey::do{say$_,for@_,do{($monkey=[caller(0)]->[3])=~s{::}{ }and$monkey}}"Monkey say"->Monkey::do'