We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 29201
    • 239 Posts
    I'm using the following code to send an email

    <?php
    $message = '<p>This email confirms that <b>'.$hook->getValue('username').'</b> has registered for Marlin Soccer Academy: '.$hook->getValue('camp').'. The details of the registration follow below:</p>';

    $message .= '<p>Camp: '.$hook->getValue('camp').'</p>';
    $message .= '<p><b>User Name: </b>'.$hook->getValue('username').'</p>';
    $message .= '<p><b>Password: </b>'.$hook->getValue('password').'</p>';
    $message .= '<p><b>Player Name: </b>'.$hook->getValue('finame').' '.$hook->getValue('lastname').'</p>';
    $message .= '<p>Club Coach Name: '.$hook->getValue('coach').'</p>';
    $message .= '<p>Club Coach Email: '.$hook->getValue('coachemail').'</p>';
    $message .= '<p>Position: '.$hook->getValue('position').'</p>';
    $message .= '<p>Graduation Year: '.$hook->getValue('graduation').'</p>';
    $message .= '<p>Parent Name: '.$hook->getValue('parent').'</p>';
    $message .= '<p>Email: '.$hook->getValue('email').'</p>';
    $message .= '<p>Address: '.$hook->getValue('address').'
    '.$hook->getValue('city').', '.$hook->getValue('state').' '.$hook->getValue('zip').'</p>';
    $message .= '<p>Telephone: '.$hook->getValue('phone').'</p>';
    $message .= '<p>Date of Birth: '.$hook->getValue('dateofbirth').'</p>';
    $message .= '<p>Age as of March 1: '.$hook->getValue('age').'</p>';
    $message .= '<p>T-shirt Size: '.$hook->getValue('tshirt').'</p>';
    $message .= '<p>Team Name: '.$hook->getValue('team').'</p>';
    $message .= '<p>Age Group: '.$hook->getValue('agegroup').'</p>';
    $message .= '<p>Insurance Company: '.$hook->getValue('inscomp').'</p>';
    $message .= '<p>Insurance Policy / Group Number: '.$hook->getValue('policy').'</p>';
    $message .= '<p>Allergic Reactions: '.$hook->getValue('allegric').'</p>';
    $message .= '<p>Medication Presently Taken: '.$hook->getValue('medication').'</p>';
    $message .= '<p>Past Illness: '.$hook->getValue('illness').'</p>';
    $message .= '<p>Father’s Full Name: '.$hook->getValue('fathername').'</p>';
    $message .= '<p>Father’s Phone (Home): '.$hook->getValue('phonehome').'</p>';
    $message .= '<p>Father’s Phone (Cell): '.$hook->getValue('phonecell').'</p>';
    $message .= '<p>Mother’s Full Name: '.$hook->getValue('mothername').'</p>';
    $message .= '<p>Mother’s Phone (Home): '.$hook->getValue('motherphonehome').'</p>';
    $message .= '<p>Mother’s Phone (Cell): '.$hook->getValue('motherphonecell').'</p>';
    $message .= '<p>Name & Phone Number To Call If Parents Cannot Be Reached: '.$hook->getValue('nameAndNumToCall').'</p>';
    $message .= '<p>Parent / Guardian Signature: '.$hook->getValue('parsign').'</p>';
    $message .= '<p>Date: '.$hook->getValue('date').'</p>';




    $modx->getService('mail', 'mail.modPHPMailer');
    $modx->mail->set(modMail::MAIL_BODY,$message);
    $modx->mail->set(modMail::MAIL_FROM,'[email protected]');
    $modx->mail->set(modMail::MAIL_FROM_NAME,'Marlin Soccer Academy');
    $modx->mail->set(modMail::MAIL_SENDER,'Marlin Soccer Academy');
    $modx->mail->set(modMail::MAIL_SUBJECT,'Marlin Soccer Academy Camp Registration');
    $modx->mail->address('to','[email protected]');
    $modx->mail->address('reply-to','[email protected]');
    $modx->mail->setHTML(true);
    //if (!$modx->mail->send()) {
    // $modx->log(modX::LOG_LEVEL_ERROR,'An error occurred while trying to send the email: '.$err);
    //}

    if (!$modx->mail->send()) {
    $modx->log(modX::LOG_LEVEL_ERROR,'An error occurred while trying to send the email: '.$modx->mail->mailer->ErrorInfo);
    }

    $modx->mail->reset();
    /* tell our snippet we're good and can continue */
    return true;


    and I'm get the following error: Invalid address: (punyEncode)

    ....I added the replyto field but no luck. Would anyone be able to shed some light on this?