Community Forums
Connect with us on LinkedIn
Community Notice
+ Reply to Thread
Results 1 to 3 of 3
  1. #1
    Member Datacenter1.com's Avatar
    Join Date
    Oct 2005
    Location
    /local/bar
    Posts
    12

    Default Sending email to customers from command line

    Hi,

    I'm writing a little script to automatic suspend resource abusers (cpu, mysql & memory) but I want to sent an email to the customer when the account is suspended, how can I do that?

    Is there a way to sent an email from command line to user X (X is a cpanel account off course )
    Planes Reseller cPanel: LiteSpeed Cloudlinux Master Reseller WHMCS RVSiteBuilder Softaculous IP Dedicada
    Datacenter1.com - Super Promo

  2. #2
    cPanel Partner NOC cPanel Partner NOC Badge
    Join Date
    Jul 2005
    Location
    New Jersey, USA
    Posts
    397

    Default

    You can use a simple mail routine in either perl or php.

    <?php
    $to = "someone@example.com";
    $subject = "Test mail";
    $message = "Hello! This is a simple email message.";
    $from = "someonelse@example.com";
    $headers = "From: $from";
    mail($to,$subject,$message,$headers);
    echo "Mail Sent.";
    ?>

  3. #3
    Member Datacenter1.com's Avatar
    Join Date
    Oct 2005
    Location
    /local/bar
    Posts
    12

    Default

    Quote Originally Posted by PlatinumServerM View Post
    You can use a simple mail routine in either perl or php.

    <?php
    $to = "someone@example.com";
    $subject = "Test mail";
    $message = "Hello! This is a simple email message.";
    $from = "someonelse@example.com";
    $headers = "From: $from";
    mail($to,$subject,$message,$headers);
    echo "Mail Sent.";
    ?>
    Thank you PlatinumServerM, I already know that

    My question is how to sent an email from command line, when the only thing I have is the customer's username, or in other words, how can I get the user's email address from his username?

    Thank You
    Planes Reseller cPanel: LiteSpeed Cloudlinux Master Reseller WHMCS RVSiteBuilder Softaculous IP Dedicada
    Datacenter1.com - Super Promo

Similar Threads & Tags
Similar threads

  1. Add email address using linux command line
    By classywear in forum E-mail Discussions
    Replies: 6
    Last Post: 08-27-2009, 11:37 AM
  2. command line commands - creating and setting up a quota to an email address
    By cteinternet in forum cPanel and WHM Discussions
    Replies: 5
    Last Post: 07-09-2009, 03:12 PM
  3. email from php or command line not working
    By redlorry919 in forum cPanel and WHM Discussions
    Replies: 0
    Last Post: 02-06-2006, 03:47 PM
  4. Problem sending email to new customers john@hisdomain.com wh
    By AbeFroman in forum cPanel and WHM Discussions
    Replies: 1
    Last Post: 05-17-2002, 06:57 AM
Linkedin       Facebook       Twitter       RSS       Flickr       YouTube