The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Contact Email - Batch Update/Change

Discussion in 'E-mail Discussions' started by GeekPatrolMille, Mar 19, 2006.

  1. GeekPatrolMille

    GeekPatrolMille Well-Known Member

    Joined:
    Mar 12, 2004
    Messages:
    84
    Likes Received:
    0
    Trophy Points:
    6
    Location:
    McKinney, Texas, USA
    Can anyone direct me to where the contact email address for a domain account is stored. I am speaking of the email address that appears on the Main >> Account Information >> List Accounts screen.

    I have a reseller who did not provid a contact email address for his clients and he has requested me to put a default email address on all of the accounts.

    Thank you in advance...
     
  2. chirpy

    chirpy Well-Known Member

    Joined:
    Jun 15, 2002
    Messages:
    13,475
    Likes Received:
    20
    Trophy Points:
    38
    Location:
    Go on, have a guess
    The email address is stored in /home/*/.contactemail for each account. You would have to write a script that populated that file with an email address for the list of accounts where it is needed.
     
  3. GeekPatrolMille

    GeekPatrolMille Well-Known Member

    Joined:
    Mar 12, 2004
    Messages:
    84
    Likes Received:
    0
    Trophy Points:
    6
    Location:
    McKinney, Texas, USA
    Who would have thought of looking in the most obvious place... <grin>

    Thanks chirpy...
     
  4. sawbuck

    sawbuck Well-Known Member

    Joined:
    Jan 18, 2004
    Messages:
    1,367
    Likes Received:
    5
    Trophy Points:
    38
    cPanel Access Level:
    Root Administrator
    Along the same lines, have found the attached script handy to extract all contactemail addresses.
     

    Attached Files:

  5. GeekPatrolMille

    GeekPatrolMille Well-Known Member

    Joined:
    Mar 12, 2004
    Messages:
    84
    Likes Received:
    0
    Trophy Points:
    6
    Location:
    McKinney, Texas, USA
    Thanks sawbuck...

    Here is my modified version of your offerings. This script will insert the email address provided into any /home/<ACCTNAME>/.contactemail file which is currently missing one. It does not overwrite the email address if it exists. It does not test for valid existing or invalid existing emails so be very cautious...

    My original request was to fix this for a reseller... Since only the reseller in question had missing contact emails, I did not do any lookups for the reseller account. This script will touch *ALL* empty .contactemail files. It will not create the file if it is missing, so system accounts should be safe. Use at your own risk...

    -greg


    #!/bin/bash

    myEmail = "email@address.com

    for i in `awk -F: '{print $1}' /etc/passwd`
    do
    if [[ -e '/home/'$i'/.contactemail' ]]; then
    email="cat /home/$i/.contactemail"
    em=`$email`
    if [[ -n $em ]]; then
    echo $em
    else
    echo $myEmail > '/home/'$i'/.contactemail'
    fi
    fi
    done
     
Loading...

Share This Page