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.

Localhost accessing e-mail server possible?

Discussion in 'E-mail Discussions' started by mport9491, Jan 8, 2012.

  1. mport9491

    mport9491 Registered

    Joined:
    Jan 8, 2012
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Website Owner
    Hey guys,

    I'm currently developing a website with an e-mail system using cPanel. I have already configured the SMTP server and the e-mail function works (I can receive random messages from website to my email). I also develop small time websites using XAMPP Server. My question is, can my XAMPP Server access the SMTP server in cPanel? If yes, could anyone specify how?
     
  2. cPanelTristan

    cPanelTristan Quality Assurance Analyst
    Staff Member

    Joined:
    Oct 2, 2010
    Messages:
    7,623
    Likes Received:
    21
    Trophy Points:
    38
    Location:
    somewhere over the rainbow
    cPanel Access Level:
    Root Administrator
    Is your XAMPP Server a separate machine from the cPanel one? If so, you'd have to authenticate using that other machine to a specific account on your cPanel machine. Otherwise, you'd have to allow that server to relay through yours by adding the IP to the /etc/alwaysrelay file that you create.

    The /etc/relayhosts file can't be manually edited as antirelayd will wipe any changes you make to it. The /usr/sbin/antirelayd script will look for /etc/alwaysrelay file, though, and then add the IPs into it into relayhosts file for you.

    The command to add an IP to the file would be:

    Code:
    echo "IP#" >> /etc/alwaysrelay
    Please replace IP# with the IP number for your XAMPP Server.
     
  3. mport9491

    mport9491 Registered

    Joined:
    Jan 8, 2012
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Website Owner
    Hey there,

    Sorry, but I'm not sure if you understood me. The XAMPP web server that I was talking about is this:

    /http://www.apachefriends.org/en/xampp.html

    And the cPanel that I'm currently using is the cPanel X. The one web-accessible.

    If you knew that, then most likely I didn't understand you at all, lol. I'm a total newbie to these kinds of things and I appreciate it if you could be much more specific.

    Is your XAMPP Server a separate machine from the cPanel one?
    - I'm working on only one computer. The XAMPP web server is installed in my computer. cPanel, on the other hand, is accessed via web. www.<friend's domain>.com/cpanel

    I got lost at the "The command to add an IP to the file would be:" part. And I have no idea where to execute this "echo "IP#" >> /etc/alwaysrelay". I have 0 knowledge regarding DOS stuff, I just know how to program PHP and the like. Lol

    Anyways, afaik, XAMPP has it's own php.ini. The problem is, I have no clue on what to change there. (I think this is the problem...)
    As I said earlier, I really do not know how these stuff work. I'm sorry for any headaches I cause you.
     
    #3 mport9491, Jan 8, 2012
    Last edited: Jan 8, 2012
  4. cPanelTristan

    cPanelTristan Quality Assurance Analyst
    Staff Member

    Joined:
    Oct 2, 2010
    Messages:
    7,623
    Likes Received:
    21
    Trophy Points:
    38
    Location:
    somewhere over the rainbow
    cPanel Access Level:
    Root Administrator
    Since you don't have root access to the cPanel machine, you wouldn't be able to revise contents on it to add the IP to /etc/alwaysrelay file. Of note, cPanel machines are Linux or FreeBSD-based, so they won't be DOS commands (that's the Windows world for DOS commands).

    For your XAMPP server when you talk about it as your local computer running it, then yes that is a separate machine trying to connect to the cPanel one. It matters that it isn't local to the cPanel machine, because that means you are trying to relay through the cPanel machine to send emails. When trying to relay remotely, you cannot use sendmail or the PHP mail() function. You have to use SMTP authentication.

    As for how you would do it, you'll have to authenticate in whatever script you use. Again, you must use SMTP authentication in any PHP script you are using. For SMTP authentication via a PHP script, if you needed those details, please see the following examples:

    How to Send Email from a PHP Script Using SMTP Authentication - About Email
    Smtp Auth Email Script

    Finally, if it turns out that you aren't trying to connect using a PHP script, then how precisely are you trying to connect?
     
  5. mport9491

    mport9491 Registered

    Joined:
    Jan 8, 2012
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Website Owner
    Well basically, you've already answered my question. Haha. And yeah I'm using a PHP script to send files using SMTP. I'm trying to configure the settings still. Anyways, thanks for the help! :)

    Oh and lastly, two questions, is it possible to view the php.ini file on my cPanel? And how do I know what my SMTP_port is? Afaik, it's located on the php.ini. Thanks!
     
    #5 mport9491, Jan 8, 2012
    Last edited: Jan 8, 2012
  6. victomeyezr

    victomeyezr Well-Known Member

    Joined:
    Sep 25, 2008
    Messages:
    54
    Likes Received:
    0
    Trophy Points:
    6
    How do you REMOVE IP address's from that file?
     
  7. cPanelTristan

    cPanelTristan Quality Assurance Analyst
    Staff Member

    Joined:
    Oct 2, 2010
    Messages:
    7,623
    Likes Received:
    21
    Trophy Points:
    38
    Location:
    somewhere over the rainbow
    cPanel Access Level:
    Root Administrator
    If you are using suPHP and your hosting provider allows local php.ini files, you can create your own php.ini file in /home/username/public_html where username is your cPanel username. Your host should always be your first line of questioning for these issues, since your host knows what PHP handler you are using and where the php.ini file is stored on the machine.

    The SMTP port is almost always 25. Sometimes, another port such as 26 or 587 is also available for SMTP traffic. Again, your hosting provider will know the answer to this question.

    Which file? You cannot remove IPs from /etc/relayhosts file as that file is auto populated by antirelayd service. If you mean from /etc/alwaysrelay, you can remove IPs using root SSH and simply removing the IP from the file via editing it.
     
Loading...

Share This Page