Jump to content

How to get client email on login ?


Recommended Posts


I'm trying to do one module to send one email to client when anyone wrong password account (like admin)

But I'm having problem to get the email on input username, all data $_POST will be send to dologin.php


My hook:



function hook_loginfail($vars) {

   if($_SERVER["REQUEST_URI"] = "incorrect=true"){

       // echo $whmcs->get_req_var('username');

       $command = "sendemail";
       $adminuser = "Rhuan";
       $values["customtype"] = "general";
       $values["customsubject"] = "Login Failed";
       $values["custommessage"] = "Olá clientname...";
       $values["id"] = 1; // With one selection on database using WHERE emailofclient to get ID, Firstname...
       $results = localAPI($command,$values,$adminuser);

       if ($results['result']!="success") echo "An Error Occurred: ".$results['result'];




I need the email of client to check on database if exist and get the id to send email address...

Thank you very much!

Edited by WHMCS TedX
Reformatted PHP code
Link to comment
Share on other sites

You can use an email program – like Microsoft Outlook, Mozilla Thunderbird, Eudora or Apple Mail – to send and receive email from your 123-reg mailboxes.


To do this, you need to add a new account to your email program. The exact way of doing this will vary depending on which program you use, but you usually need to find the add new email account option.


Please check the user guide for your email program to find out exactly how to do this – there are links to instructions for the most popular mail programs towards the bottom of this page.

When adding a new email account, you’ll be asked to supply some details. Enter them as follows:


For POP3:


Mail account type: POP3

Incoming mail server (POP): pop.123-reg.co.uk

Outgoing mail server (SMTP): smtp.123-reg.co.uk



Mail account type: IMAP

Incoming mail server (IMAP): imap.123-reg.co.uk

Outgoing mail server (SMTP): smtp.123-reg.co.uk

When adding a new email account, you’ll be asked to supply some details. Enter them as follows:


Username: The username for the mailbox (full email address)

Password: The password for the mailbox

Make sure you choose the outgoing mail server requires authentication option.

Link to comment
Share on other sites

Wouldn't $_SERVER["REQUEST_URI"] actually equal "/login.php?incorrect=true" or "/clientarea.php?incorrect=true"


You would be better using $_GET["incorrect"];

Yes, can be...

But the problem is how to get the email address of client use to try login in field username.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated