This article provides you with information regarding mail scripts  via Plesk.



Unlike the cPanel control panel sending mails through “localhost” is disabled on windows Plesk . You  would need to use an existing email account or create a new email account through Plesk control panel for authentication in their send mail scripts. 


 

Example of and ASP Mail Script


<%@ Import Namespace="System.Net" %>
 <%@ Import Namespace="System.Net.Mail" %>
  
 <script language="C#" runat="server">
     protected void Page_Load(object sender, EventArgs e)
     {
        //create the mail message
         MailMessage mail = new MailMessage();
  
         //set the addresses
         mail.From = new MailAddress("yourname@yourdomain.com");
         mail.To.Add("recipient_email@domain.com");
         
         //set the content
         mail.Subject = "This is a test email from C# script";
         mail.Body = "This is a test email from C# script";
         //send the message
          SmtpClient smtp = new SmtpClient("smtp.yourdomain.com");
           
          NetworkCredential Credentials = new NetworkCredential("smtp@yourdomain.com", "password");
          smtp.Credentials = Credentials;
          smtp.Send(mail);
          lblMessage.Text = "Mail Sent";
     }
 </script>
 

 

 

Example of PHP Mail Script

 

<?php
require_once "Mail.php";
 $from = "Sandra Sender <sender@example.com>";
$to = "Ramona Recipient <recipient@example.com>";
$subject = "Hi!";
$body = "Hi,\n\nHow are you?";
 $host = "mail.gdom.net";
$username = "lfc hosted email";
$password = "email password";
 $headers = array ('From' => $from,
   'To' => $to,
   'Subject' => $subject);
$smtp = Mail::factory('smtp',
   array ('host' => $host,
     'auth' => true,
     'username' => $username,
     'password' => $password));
 $mail = $smtp->send($to, $headers, $body);
 if (PEAR::isError($mail)) {
   echo("<p>" . $mail->getMessage() . "</p>");
  } else {
   echo("<p>Message successfully sent!</p>");
  }

?>