|
Answer by: George Kaloyanov,
Aplus.Net Knowledge Base Support
You can send emails off the shared hosting
server using the built-in mail() function of PHP.
The required parameters of the mail() function
are:
- The
Recipient’s Email Address.
- The
Email Subject.
- The
Email Message Content.
We strongly recommend that you insert custom
headers in order to define the Sender’s Email Address too.
Although this is not required, it is always a good idea to define
the real sender of the email. If you define the real sender, your
recipients will be able to reply to your emails sent through the
php script. Otherwise, the recipient will not be able to see the
real sender, thus not able to reply to you.
Example: mail($to, $subject, $message, $headers)
Here is the whole php script example:
<?php
$to= 'recipient@example.com';
$subject='your subject';
$message='hello';
$headers='From: sender@yourdomain.com';
$result=mail($to, $subject, $message, $headers);
if (!$result){
die('Email Message Not Sent');
}
echo 'Email Message Sent';
?>
Related links:
|