php - How to Setup up Gsuite smtp-relay and PHPMailerGet the solution ↓↓↓
Hi I've been struggling with how to setup the SMTP-relay that comes with gsuite. I have asked google support but not even they know. What is happening is when i run this code to send emails no emails show up in my gsuite not even in spam either. I have used this exact same code successfully changing the SMTP host to premium64.web-hosting.com and it works great for every email address other than sending to gsuite. I have tried sending it to a different gsuite as well and it still does not work for both the smtp-relay and for the premium64. Thinking it has to be a setting with google admin because google is really strict on security. I have enabled less secure apps. Here below is my code and the current setting. Please show me what needs to be changed so that it works. I've had a tough enough time working on this for the last 4 days. Any help is appreciated and thank you in advance. Thank you.
$sentfromemail = "[email protected]"; $mail = new PHPMailer(); // $mail->isSMTP(); $mail->SMTPAuth = true; $mail->SMTPSecure = 'ssl'; $mail->Host = 'smtp-relay.gmail.com'; $mail->Port = '465'; $mail->isHTML(true); $mail->Username = $sentfromemail; $mail->Password = 'correctpassword'; $mail->SetFrom('[email protected]' , 'Email Name'); $mail->Subject = "test"; $mail-> Body = 'test';
Google Admin Console Settings:
Share solution ↓
Link To Answer People are also looking for solutions of the problem: warning: undefined array key
Didn't find the answer?
Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.
Find the answer in similar questions on our website.
Write quick answer
Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.