12. Sending email from your CGI script
A secured subroutine is available which allows the sending of mail from a CGI program. The syntax is:
mail(RECIPIENT, SUBJECT,
CONTENTS);
mail('foo@bar.baz', 'Test mail', "Hello
world\n")
Note that @ interpolates an array when used in double quotes ("") (unlike in perl4 which tried to guess whether you wanted to interpolate or have a raw @ in there). If you want to hard-wire an email address with an @ in it then either use single quotes or prefix the @ with a backslash ("$user\@wherever"). Note also that you gather the whole message together into one string to pass as the third argument.
Email sent in this way will have a sender address of your own University email address.
Up: Contents Previous: 11. Do you have any generic Perl scripts available? Next: 13. Writing your own Safe Perl.

