Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"$emailAddress" must be a valid email address. Got: theuseremail@rcs.k12.al.us #1073

Open
unexplainablesolutions opened this issue Dec 15, 2021 · 1 comment
Labels
status: help wanted requesting help from the community type: bug bug in the library

Comments

@unexplainablesolutions
Copy link

Issue Summary

Yii2 Sendgrid implementation. Sending to any user at domain of @rcs.k12.al.us throws error below. When using local mailer and not sendgrid, email sends just fine and end user gets it. I'm thinking its the form of the 'education' domain. How can I either turn off this 'check', allow the email adddress, etc to get it to work? Reason being I have a loop to send out an email in a list, and once it hits one of these emails it bonks and doesnt send to the rest of the list. I'd obviously prefer for them to get the email, but the immediate bandaid would be just to skip them for now so my app doesnt appear broken. Im thinking it doesnt like the email domain and it thinks its malformed.

I sure would appreciate any and all help and suggestions as this is a live app. I replaced the domain name and the actual email address for security purposes in this below.

Code Snippet

SendGrid\Mail\TypeException: "$emailAddress" must be a valid email address. Got: useremail@rcs.k12.al.us in /home/uu5d5xjrheya/public_html/mytestdomain.com/vendor/sendgrid/sendgrid/lib/helper/Assert.php:61
Stack trace:
#0 /home/uu5d5xjrheya/public_html/mytestdomain.com/vendor/sendgrid/sendgrid/lib/mail/EmailAddress.php(69): SendGrid\Helper\Assert::email('useremail@rcs....', 'emailAddress')
#1 /home/uu5d5xjrheya/public_html/mytestdomain.com/vendor/sendgrid/sendgrid/lib/mail/EmailAddress.php(47): SendGrid\Mail\EmailAddress->setEmailAddress('useremail@rcs....')
#2 /home/uu5d5xjrheya/public_html/mytestdomain.com/vendor/sendgrid/sendgrid/lib/mail/Mail.php(191): SendGrid\Mail\EmailAddress->__construct('useremail@rcs....', NULL, NULL)
#3 /home/uu5d5xjrheya/public_html/mytestdomain.com/vendor/sendgrid/sendgrid/lib/mail/Mail.php(389): SendGrid\Mail\Mail->addRecipientEmail('To', 'useremail@rcs....', NULL, NULL, NULL, NULL)
#4 /home/uu5d5xjrheya/public_html/mytestdomain.com/myapp/models/SendEmail.php(46): SendGrid\Mail\Mail->addTo('useremail@rcs....')
#5 /home/uu5d5xjrheya/public_html/mytestdomain.com/myapp/modules/group/controllers/DefaultController.php(552): myapp\models\SendEmail::sendLiveEmail('useremail@rcs....', '

test 123

...', false, 'Sunday Adult Bi...')
#6 [internal function]: myapp\modules\group\controllers\DefaultController->actionMassnotify()
#7 /home/uu5d5xjrheya/public_html/mytestdomain.com/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array(Array, Array)
#8 /home/uu5d5xjrheya/public_html/mytestdomain.com/vendor/yiisoft/yii2/base/Controller.php(181): yii\base\InlineAction->runWithParams(Array)
#9 /home/uu5d5xjrheya/public_html/mytestdomain.com/vendor/yiisoft/yii2/base/Module.php(534): yii\base\Controller->runAction('massnotify', Array)
#10 /home/uu5d5xjrheya/public_html/mytestdomain.com/vendor/yiisoft/yii2/web/Application.php(104): yii\base\Module->runAction('group/default/m...', Array)
#11 /home/uu5d5xjrheya/public_html/mytestdomain.com/vendor/yiisoft/yii2/base/Application.php(392): yii\web\Application->handleRequest(Object(yii\web\Request))
#12 /home/uu5d5xjrheya/public_html/mytestdomain.com/UI/web/index.php(73): yii\base\Application->run()
#13 {main}
Copy StacktraceSearch StackoverflowSearch GoogleException
SendGrid\Mail\TypeException
"$emailAddress" must be a valid email address. Got: useremail@rcs.k12.al.us

  1. in /home/uu5d5xjrheya/public_html/mytestdomain.com/vendor/sendgrid/sendgrid/lib/helper/Assert.phpat line 61
    52535455565758596061626364656667686970 $flags = (defined('FILTER_FLAG_EMAIL_UNICODE')) ? FILTER_FLAG_EMAIL_UNICODE : null;

     if (filter_var($value, FILTER_VALIDATE_EMAIL, $flags) === false) {
         $message = sprintf(
             $message ?: '"$%s" must be a valid email address. Got: %s',
             $property,
             $value
         );
    
         throw new TypeException($message);
     }
    

    }

    /**

    • Assert that value is an integer.
    • @param mixed $value
    • @param string $property
    • @param string|null $message
  2. in /home/uu5d5xjrheya/public_html/mytestdomain.com/vendor/sendgrid/sendgrid/lib/mail/EmailAddress.php at line 69– SendGrid\Helper\Assert::email('useremail@rcs.k12.al.us ', 'emailAddress')
    63646566676869707172737475 * @param string $emailAddress The email address
    *

    • @throws TypeException
      */
      public function setEmailAddress($emailAddress)
      {
      Assert::email($emailAddress, 'emailAddress');

      $this->email = $emailAddress;
      }

    /**

    • Retrieve the email address from a EmailAddress object
  3. in /home/uu5d5xjrheya/public_html/mytestdomain.com/vendor/sendgrid/sendgrid/lib/mail/EmailAddress.php at line 47– SendGrid\Mail\EmailAddress::setEmailAddress('useremail@rcs.k12.al.us ')
    41424344454647484950515253 $emailAddress = null,
    $name = null,
    $substitutions = null,
    $subject = null
    ) {
    if (isset($emailAddress)) {
    $this->setEmailAddress($emailAddress);
    }
    if (isset($name) && $name !== null) {
    $this->setName($name);
    }
    if (isset($substitutions)) {
    $this->setSubstitutions($substitutions);

  4. in /home/uu5d5xjrheya/public_html/mytestdomain.com/vendor/sendgrid/sendgrid/lib/mail/Mail.php at line 191– SendGrid\Mail\EmailAddress::__construct('useremail@rcs.k12.al.us ', null, null)
    185186187188189190191192193194195196197 $personalization = null
    ) {
    $personalizationFunctionCall = 'add' . $emailType;
    $emailTypeClass = '\SendGrid\Mail\' . $emailType;
    if (!($email instanceof $emailTypeClass)) {
    $email = new $emailTypeClass(
    $email,
    $name,
    $substitutions
    );
    }

     if ($personalizationIndex === null && $personalization === null
    
  5. in /home/uu5d5xjrheya/public_html/mytestdomain.com/vendor/sendgrid/sendgrid/lib/mail/Mail.php at line 389– SendGrid\Mail\Mail::addRecipientEmail('To', 'useremail@rcs.k12.al.us ', null, null, ...)
    383384385386387388389390391392393394395 $this->addRecipientEmail(
    'To',
    $to,
    $name,
    $substitutions,
    $personalizationIndex,
    $personalization
    );
    }

    /**

    • Adds multiple email recipients to a Personalization object
  6. in /home/uu5d5xjrheya/public_html/mytestdomain.com/myapp/models/SendEmail.php at line 46– SendGrid\Mail\Mail::addTo('useremail@rcs.k12.al.us ')
    40414243444546474849505152 if (Customer::getEmailallowed() =='1') {

         Customer::updateEmailcount($_SESSION['customerID'],1);
         $email = new \SendGrid\Mail\Mail();
         $email->setFrom("info@churchharmony.com", "ChurchHarmony Notification");
         $email->setSubject($subject);
         $email->addTo($uemail);
         $email->addContent("text/plain", "$body");
         $email->addContent(
             "text/html", "$body"
         );
         $sendgrid = new \SendGrid(Yii::$app->params['SMTP_USERNAME']);
         try {
    
  7. in /home/uu5d5xjrheya/public_html/mytestdomain.com/myapp/modules/group/controllers/DefaultController.php at line 552– myapp\models\SendEmail::sendLiveEmail('useremail@rcs.k12.al.us ', '

    test 123

    1. test 1</l...', false, 'Sunday Adult Bible Class Group L...')
      546547548549550551552553554555556557558 {
      foreach (DefaultController::getMultinotifylistemail($id) as $entry) {

                   $ue = $entry['email'];
      
                   // Send Email to each person in the Group
                   SendEmail::sendLiveEmail($ue,$_REQUEST['notes'], false,$this->getEventname($id).' Group Leader Notification');
      
      
      
      
               }
           }
      
    2. myapp\modules\group\controllers\DefaultController::actionMassnotify()

    3. in /home/uu5d5xjrheya/public_html/mytestdomain.com/vendor/yiisoft/yii2/base/InlineAction.php at line 57– call_user_func_array([myapp\modules\group\controllers\DefaultController, 'actionMassnotify'], [])

    4. in /home/uu5d5xjrheya/public_html/mytestdomain.com/vendor/yiisoft/yii2/base/Controller.php at line 181– yii\base\InlineAction::runWithParams(['r' => 'group/default/massnotify', 'id' => '126'])

    5. in /home/uu5d5xjrheya/public_html/mytestdomain.com/vendor/yiisoft/yii2/base/Module.php at line 534– yii\base\Controller::runAction('massnotify', ['r' => 'group/default/massnotify', 'id' => '126'])

    6. in /home/uu5d5xjrheya/public_html/mytestdomain.com/vendor/yiisoft/yii2/web/Application.php at line 104– yii\base\Module::runAction('group/default/massnotify', ['r' => 'group/default/massnotify', 'id' => '126'])

    7. in /home/uu5d5xjrheya/public_html/mytestdomain.com/vendor/yiisoft/yii2/base/Application.php at line 392– yii\web\Application::handleRequest(yii\web\Request)

    8. in /home/uu5d5xjrheya/public_html/mytestdomain.com/UI/web/index.php at line 73– yii\base\Application::run()
      67686970717273747576
      function setSessionParams()
      {
      $_SESSION['SHOW_DEBUG_TOOLBAR']=Yii::$app->params['SHOW_DEBUG_TOOLBAR'];
      }

    $application->run();

    ini_set('upload_max_filesize', Yii::$app->params['FILE_SIZE']);
    ini_set('post_max_size', Yii::$app->params['FILE_SIZE']);
    $_GET = [
    'r' => 'group/default/massnotify',
    'id' => '126',
    ];

    $_POST = [
    '_csrf' => 'Zf85DVjNeU6lLU9R0oMgsEHjEXTY36Lf5nXwLUmeesYNu2w7YP8TKtwVdwKj4WuFNpQgHLyO04eNLbVdDNkMvw==',
    'entity_id' => '126',
    'add_note_model' => 'true',
    'notes' => '

    test 123

    1. test 1
    2. test 2
    3. test 3

    Powered by Froala Editor

    ',
    'PublicEmail' => 'Yes',
    'PublicTxt' => 'Yes',
    'Submit' => 'Save Notes',
    ];

    $_COOKIE = [
    '_fbp' => 'fb.1.1639004629654.538481051',
    '_ga' => 'GA1.1.1361995484.1639004630',
    '_fbc' => 'fb.1.1639520920479.IwAR2wlIM3x0-34QHKqrb9wDxoTFjz-vpYbsPGR9LfGKhQQjCxiVE1gorN59M',
    '_ga_0F94PXX5FZ' => 'GS1.1.1639520861.21.1.1639521098.0',
    'PHPSESSID' => '7c3a28124f45ab60fbb96c29280d59dc',
    '_csrf' => 'd43014f54051665794cbeb5c03fa01886dbf41d0059638601973784198ed7aaaa:2:{i:0;s:5:"_csrf";i:1;s:32:"hDU682jdy88SqbK5ww1hdQqXkXEpEGvy";}',
    'inserted_notes126' => '1',
    '_ga_5194BKNK0Z' => 'GS1.1.1639529185.13.1.1639529329.0',
    ];

    $_SESSION = [
    'LOCALE' => 'en-US',
    '__flash' => [],
    'SHOW_DEBUG_TOOLBAR' => 'No',
    '__returnUrl' => 'https://mytestdomain.com/',
    'base_url' => 'https://mytestdomain.com/',
    '__id' => 278,
    '__authKey' => '',
    '__expire' => 1639532979,
    'username' => 'Brad_Rush_278',
    'SessionDetailsId' => '7c3a28124f45ab60fbb96c29280d59dc',
    'userID' => 278,
    'customerID' => 9,
    ];
    Yii Framework
    2021-12-15, 00:49:39

    Apache

    Yii Framework/2.0.43

@childish-sambino
Copy link
Contributor

This issue has been added to our internal backlog to be prioritized. Pull requests and +1s on the issue summary will help it move up the backlog.

@childish-sambino childish-sambino added status: help wanted requesting help from the community type: bug bug in the library labels Feb 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: help wanted requesting help from the community type: bug bug in the library
Projects
None yet
Development

No branches or pull requests

2 participants