'GRAPHQL: Return Object key/value pairs that match variable
Tring to query GraphQL dynamically with a language code but seems that any variable passed to the query has to be the value of a element and not a key. Any way to match keys to a variable?
Schema
title: {
en: "English Title",
de: "German Title",
...
}
Query
query ($lang: String) {
homePage(filter: { title: $lang }) {
title
}
}
Solution 1:[1]
If you want to send emails using gmail's SMTP, sendmail is not what you want to use.
in your .env
MAIL_DRIVER=smtp
MAIL_HOST=smtp.googlemail.com
MAIL_PORT=465
MAIL_USERNAME=ENTER_YOUR_EMAIL_ADDRESS(GMAIL)
MAIL_PASSWORD=ENTER_YOUR_GMAIL_PASSWORD
MAIL_ENCRYPTION=ssl
Login to your Google Email Account and click on Google Account Button. This button is display when you click on the profile picture in your Gmail Dashboard as shown.
Once you are on My Account Page then click on Security and scroll down to the bottom and you will find ‘Less secure app access’ settings. Click on the radio button to set it ON.
After that you can do something like
$to_name = 'RECEIVER_NAME';
$to_email = 'RECEIVER_EMAIL_ADDRESS';
$data = array('name'=>$to_name, 'body' => 'A test mail');
Mail::send('emails.mail', $data, function($message) use ($to_name, $to_email) {
$message->to($to_email, $to_name)
->subject('Laravel Test Mail');
$message->from('SENDER_EMAIL_ADDRESS','Test Mail');
});
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Patrick Simard |
