I have made some code to send email and receive email for my website however, it keeps giving me an error message. The error message can be accessed through the link below, or a short version has been copied and pasted here. How do I successfully allow the customer to send me an email? In this example I want to use tanz61791@gmail.com as the customer to send an email to aleksanderhowell@gmail.com as the customer support email.
Connection could not be established with host smtp.marketing4growth.com :stream_socket_client(): php_network_getaddresses: getaddrinfo failed: No such host is known. https://flareapp.io/share/v5pwB27E#F59
Some code I have used to create this functionality of allowing the customer to fill in a form to send an email to me for customer support help is shown below. If you want to see the full code, you can through my GitHub repository link located below the code shown.
SendEmailController.php
public function send(Request $request){
$this->validate($request, [
'name' => 'required',
'email' => 'required|email',
'message' => 'required'
]);
$data = array(
'name' => $request->name,
'message' => $request->message
);
Mail::to('aleksanderhowell@gmail.com')->send(new SendMail($data));
return back()->with('success', 'Thanks for contacting us!');
}
SendMail.php
public function build()
{
return $this->from('tanz61791@gmail.com')->subject('New Customer Enquiry')-
>view('dynamic_email')->with('data', $this->data);
}
.env
MAIL_MAILER=smtp
MAIL_HOST=smtp.gmail.com
MAIL_PORT=80
MAIL_USERNAME=aleksanderhowell
MAIL_PASSWORD=^[qqP-mJV8HG#FPN
MAIL_ENCRYPTION=null
smtp.marketing4growth.com
coming from? It's not anywhere in the code you've shared. Are you sure you're using the .env file? – apokryfos Sep 19 '20 at 7:16marketing4growth.com.au
. – Andrew T. Sep 19 '20 at 15:25