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 string. Got: [email protected] #18

Closed
isaacdarcilla opened this issue Dec 4, 2023 · 4 comments
Closed

$emailAddress must be a string. Got: [email protected] #18

isaacdarcilla opened this issue Dec 4, 2023 · 4 comments

Comments

@isaacdarcilla
Copy link

image

@isaacdarcilla
Copy link
Author

Default should be $notifiable->email->value instead of $notifiable->email.

@aozisik
Copy link
Contributor

aozisik commented Dec 11, 2023

Hi @isaacdarcilla,

The readme was out of date. Actually we use the routeNotificationFor('mail') method. This is the correct interface method to use for notifiables, and it's expected to return the email address as a string. You might want to check your implementation of this method in the User class (or your notifiable model).

https://laravel.com/docs/10.x/notifications#customizing-the-recipient

In case you don't want to touch your model code, you can always add a custom "->to" directive and pass the email address that way instead. If you provide at least one "to" address to the SendGridMessage instance, the library will use that instead.

I'm closing this issue for now, but feel free to re-open if necessary.

@aozisik aozisik closed this as completed Dec 11, 2023
@isaacdarcilla
Copy link
Author

Hi @isaacdarcilla,

The readme was out of date. Actually we use the routeNotificationFor('mail') method. This is the correct interface method to use for notifiables, and it's expected to return the email address as a string. You might want to check your implementation of this method in the User class (or your notifiable model).

https://laravel.com/docs/10.x/notifications#customizing-the-recipient

In case you don't want to touch your model code, you can always add a custom "->to" directive and pass the email address that way instead. If you provide at least one "to" address to the SendGridMessage instance, the library will use that instead.

I'm closing this issue for now, but feel free to re-open if necessary.

Thank you for the details.

@aozisik
Copy link
Contributor

aozisik commented Dec 13, 2023

Hi @isaacdarcilla,

This might not affect the specific issue that you encountered, but I just realised the routeNotificationForMail can also return an array (['email_address' => 'name']) as well.

I opened a PR for this, and will release this soon.

@aozisik aozisik closed this as completed Dec 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants