1

I have an email here: gmx.de

When I send an email from my Gmail account to gmx.de account then it's working fine :)

But when I try to send email using PHPMailer to my gmx.de account then I don't receive any message in my gmx.de account but in PHP it's showing success message.

PHP code:

<?php
include('phpmailer/PHPMailer.php');

$email            = new PHPMailer();        
$email->isHTML(true);
$email->From      = 'xxx@gmail.com';
$email->FromName  = 'Test Name';
$email->Subject   = 'Test Subject';
$email->Body      = 'This is a test message';
$email->AddAddress('xxx.xxx@gmx.de');   

if ( $email->Send() ) {
    echo 'mail sent';
} else {
    echo 'sorry not sendt';
}

Is there any workaround?

Shibbir
  • 409
  • 3
  • 14

1 Answers1

2

You need to connect to an SMTP server first, like the Gmail SMTP and than you can send email. Take care for the 2 factor authentication, because a simple connection will be not enought. You can find some code here: Send email using the GMail SMTP server from a PHP page

DiabloSteve
  • 431
  • 2
  • 13