E-mail odbierany tylko z poczty onetu - phpmailer

0

Pod host mam wprowadzony adres smtp poczty onetu. Niestety to jest coś nie tak z tym, bo nie przychodzą do mnie e-maile z innych poczt, typu interia czy gmail.
Kod:

$mail->Host       = "smtp.poczta.onet.pl"; // SMTP server
$mail->SMTPDebug  = 2;                     // enables SMTP debug information (for testing)
$mail->SMTPAuth   = true;                  // enable SMTP authentication
$mail->Host       = "smtp.poczta.onet.pl"; // sets the SMTP server
$mail->Port       = 25;                    // set the SMTP port for the GMAIL server

Co wpisać, żeby działało na wszystkie poczty?

0

Sam sobie udzieliłeś odpowiedzi w pierwszym zdaniu.

0

Czyli mam wpisać adres smtp serwera nawet jak nie mam tam poczty? Serwer mam na ovh.pl, czyli smtp.ovh.pl czy jak?

0

Podpowie ktoś jak mam to zrobić?
Pocztę mam na gmail`u a hosting na ovh. Chcę, żeby przychodził do mnie e-maile przez formularz kontaktowy. Formularz jest zrobiony tylko problem z klasą phpmailer. Pomoże ktoś? To ważne.

0

Mam tak:

require_once('../phpmailer/class.phpmailer.php');
//include("class.smtp.php"); // optional, gets called from within class.phpmailer.php if not already loaded

$mail = new PHPMailer(true); // the true param means it will throw exceptions on errors, which we need to catch

$mail->IsSMTP(); // telling the class to use SMTP

try {
	$mail->Host       = "smtp.domena.pl"; // SMTP server
	$mail->SMTPDebug  = 2;                     // enables SMTP debug information (for testing)
	$mail->SMTPAuth   = true;                  // enable SMTP authentication
	$mail->SMTPSecure = 'ssl';                 // sets the prefix to the servier
	$mail->Host       = "smtp.gmail.com";      // sets GMAIL as the SMTP server
	$mail->Port       = 465;                    // set the SMTP port for the GMAIL server
	$mail->Username   = "MyEmail"; // SMTP account username
	$mail->Password   = "Password";        // SMTP account password
	$mail->AddAddress('Mymail','MyName');
	$mail->SetFrom(''.$email.'', ''.$topic.'');
	$mail->Subject = ''.$topic.'';
	$mail->IsHTML(true);
	$mail->SMTPDebug = false;
	$mail->CharSet = "UTF-8";
	$mail->AltBody = nl2br($message); // optional - MsgHTML will create an alternate automatically
	$mail->Body = nl2br('Wiadomość od: '.$name.' || Treść: '.$message.'');
	$mail->Send();
	
	} catch (phpmailerException $e) {
	echo $e->errorMessage(); //Pretty error messages from PHPMailer
	} catch (Exception $e) {
	echo $e->getMessage(); //Boring error messages from anything else!
}

Co tu jest źle, że przy próbie wysłania e-maila przez formularz kontaktowy otrzymuję taki błąd:

SMTP Error: Could not authenticate.

I e-mail się nie wysyła. Co zrobić?

0

Sprawdź czy dobrze podałeś nazwę użytkownika i hasło. Spróbuj użyć portu 587.

0

Hasło i użytkownik są poprawnie podane. Port 587 też nic nie daje. W sieci znalazłem taki kod:

require_once('../phpmailer/class.phpmailer.php');
		//include("class.smtp.php"); // optional, gets called from within class.phpmailer.php if not already loaded
		
		$mail = new PHPMailer(true); // the true param means it will throw exceptions on errors, which we need to catch
		
		$mail->IsSMTP(); // telling the class to use SMTP
		
		try {

			$mail = new PHPMailer();
			$mail->IsHtml(false); //format wiadomości jeśli true=HTML, false=TXT
			$mail->CharSet = "utf-8";
			$mail->PluginDir = "/var/www/portfolio/phpmailer/";
			$mail->From = "email"; // od
			$mail->FromName = "email"; //nazwa 
			$mail->Host = "smtp.gmail.com"; //adres gmaila ;)
			$mail->Port = 587; //port gmaila
			$mail->Mailer = "smtp"; 
			$mail->Username = "email";//nazwa admina na poczcie
			$mail->Password = "Mojehasło";//hasło admina do konta SMTP
			$mail->SMTPAuth = true;
			$mail->SetLanguage("pl", "language/");
			$mail->SetFrom(''.$email.'', ''.$topic.'');
			$mail->Subject = ''.$topic.'';
			$mail->AltBody = nl2br($message); // optional - MsgHTML will create an alternate automatically
			$mail->Body = nl2br('Wiadomość od: '.$name.' || Treść: '.$message.'');
			$mail->Send();
			
			} catch (phpmailerException $e) {
			echo $e->errorMessage(); //Pretty error messages from PHPMailer
			} catch (Exception $e) {
			echo $e->getMessage(); //Boring error messages from anything else!
		}

Otrzymuję wiadomość, że e-mail został wysłany lecz nie otrzymuję nic na moją pocztę. Ma ktoś jeszcze jakiś pomysł?

0

Pomoże ktoś coś?

1 użytkowników online, w tym zalogowanych: 0, gości: 1