$contact = Contact::create([
'whom_id'=>$request->whom_id,
'name'=>$request->name,
'lastname'=>$request->lastname,
'father_name'=>$request->father_name,
'email'=>$request->email,
'phone'=>$request->phone,
'address'=>$request->address,
'topic'=>$request->topic,
'apply_type_id'=>$request->apply_type_id,
'text'=>$request->text,
'ip_address'=>$request->ip(),
]);
$details = [
'whom'=>$contact->whom->vezife_az,
'apply_type'=>$contact->apply_type->name_az,
'topic'=>$contact->topic,
'text'=>$contact->text,
'tel'=>$contact->phone,
'email'=>$contact->email,
'address'=>$contact->address,
'full_name' => $contact->name.' '.$contact->lastname.' '.$contact->father_name,
];
$mail = new \PHPMailer\PHPMailer\PHPMailer(true); // notice the \ you have to use root namespace here
$mail->isSMTP(); // tell to use smtp
$mail->CharSet = "utf-8"; // set charset to utf8
$mail->SMTPAuth = true; // use smpt auth
$mail->SMTPSecure = "tls"; // or ssl
$mail->Host = "smtp.office365.com";
$mail->Port = 587; // most likely something different for you. This is the mailtrap.io port i use for testing.
$mail->Username = "noreply@example.com";
$mail->Password = "******";
$mail->setFrom("noreply@example.com", "noreply");
$mail->Subject = $contact->topic;
$mail->IsHTML(true);
$mail->Body = view('emails.contact-mail', ['details' => $details])->render();
$mail->addAddress($contact->whom->email, $contact->whom->vezife_az);
$mail->ClearReplyTos();
$mail->addReplyTo($request->email, $request->name.' '.$request->lastname.' '.$request->father_name);
$mail->send();
return \response()->json([
'message' => __('Müraciətiniz uğurla göndərildi'),
],200);
Digər dildə:
EN