Paulo Jorge Posted July 2, 2012 at 02:34 PM Report #466813 Posted July 2, 2012 at 02:34 PM tinha este código funcional, mas de repente deixou de dar e apareceu este erro alguem me sabe dizer o porque ? // value sent from form $nome=$_POST['nome']; $email=$_POST['email']; $assunto=$_POST['assunto']; $mensagem=$_POST['mensagem']; //error_reporting(E_ALL); error_reporting(E_STRICT); date_default_timezone_set('America/Toronto'); require_once('class.phpmailer.php'); //include("class.smtp.php"); // optional, gets called from within class.phpmailer.php if not already loaded $mail = new PHPMailer(); //$body = file_get_contents('contents.html'); $body = $mensagem;//eregi_replace("[\]",'',$body); $mail->IsSMTP(); // telling the class to use SMTP $mail->Host = "mail.yourdomain.com"; // SMTP server $mail->SMTPDebug = 2; // enables SMTP debug information (for testing) // 1 = errors and messages // 2 = messages only $mail->SMTPAuth = true; // enable SMTP authentication $mail->SMTPSecure = "tsl"; // sets the prefix to the servier $mail->Host = "smtp.gmail.com"; // sets GMAIL as the SMTP server $mail->Port = 587; // set the SMTP port for the GMAIL server $mail->Username = "...@gmail.com"; // GMAIL username $mail->Password = "...."; // GMAIL password $mail->SetFrom($email, $nome); $mail->AddReplyTo("name@yourdomain.com","First Last"); $mail->Subject = $assunto; $mail->AltBody = "Olá, ".$name; // optional, comment out and test $mail->MsgHTML($body); $address = $email; $mail->AddAddress('paulojorgeoliveiralopes@gmail.com', 'Paulo Lopes'); $mail->AddAttachment("images/infor.gif"); // attachment $mail->Send();
ruimcosta Posted July 2, 2012 at 05:22 PM Report #466866 Posted July 2, 2012 at 05:22 PM O que ele diz é que não se consegue ligar ao smtp do Google com essas credenciais. Abraços e beijinhos,Rui Costa
dash Posted July 2, 2012 at 10:31 PM Report #466935 Posted July 2, 2012 at 10:31 PM Eu tenho um endereço diferente de ligação ao servidor do GMail. Experimentei agora e funcionou bem: <?php require_once('class.phpmailer.php'); $mail = new PHPMailer(); // ---------- adjust these lines --------------------------------------- $mail->Username = "meuutilizador@gmail.com"; // your GMail user name $mail->Password = "minhapassword"; $mail->AddAddress("endereço de envio@hotmail.com"); // recipients email $mail->FromName = "nome de envio"; // readable name $mail->Subject = "Subject title"; $mail->Body = "Here is the message you want to send to your friend."; //----------------------------------------------------------------------- $mail->Host = "ssl://smtp.gmail.com"; // GMail $mail->Port = 465; $mail->IsSMTP(); // use SMTP $mail->SMTPAuth = true; // turn on SMTP authentication $mail->From = $mail->Username; if(!$mail->Send()) echo "Mailer Error: " . $mail->ErrorInfo; else echo "Message has been sent"; ?> Podes tirar isto também, não está lá a fazer nada. $mail->Host = "mail.yourdomain.com"; // SMTP server
Paulo Jorge Posted July 3, 2012 at 04:54 PM Author Report #467045 Posted July 3, 2012 at 04:54 PM já coloquei esse código e volta a dar SMTP Error: Could not connect to SMTP host. Mailer Error: SMTP Error: Could not connect to SMTP host.
dash Posted July 3, 2012 at 04:58 PM Report #467047 Posted July 3, 2012 at 04:58 PM Experimenta aquele que colei num ficheiro à parte, com os teus dados, porque isso que coloquei garantidamente funciona.
Paulo Jorge Posted July 3, 2012 at 05:10 PM Author Report #467049 Posted July 3, 2012 at 05:10 PM foi o que eu fiz coloquei a parte e não dá da-me aquele erro
dash Posted July 3, 2012 at 05:21 PM Report #467052 Posted July 3, 2012 at 05:21 PM E estás a usar isso localmente ou num alojamento? Firewall a bloquear ligação, não?
Paulo Jorge Posted July 3, 2012 at 05:25 PM Author Report #467053 Posted July 3, 2012 at 05:25 PM estou a utilizar o xampp . localhost. como sei se a firewall está a bloquear ?
dash Posted July 3, 2012 at 05:39 PM Report #467057 Posted July 3, 2012 at 05:39 PM Experimenta a desactivá-la, corres o script e vês o resultado. Depois voltas a ligar.
Paulo Jorge Posted July 3, 2012 at 07:56 PM Author Report #467101 Posted July 3, 2012 at 07:56 PM Já experimentei e continua a dar o erro, o erro poderá estar no class mailer ?
dash Posted July 3, 2012 at 10:32 PM Report #467159 Posted July 3, 2012 at 10:32 PM Não acredito que seja da classe. Acredito mais que há qualquer coisa a nível do PHP ou do PC a bloquear a ligação exterior para efectuar a ligação. Mas sinceramente, não te sei dizer o quê.
Paulo Jorge Posted July 4, 2012 at 12:24 AM Author Report #467180 Posted July 4, 2012 at 12:24 AM A nivel php duvido porque eu tenho a enviar email nos contactos, no carrinho de compras, na recuperação de palavra pass e ambos funcionavam agora é que deixou de funcionar, talvez seja o avast a semana passada ocorreu um erro e agora nem o consigo ligar nem desinstalar
Paulo Jorge Posted July 4, 2012 at 12:05 PM Author Report #467227 Posted July 4, 2012 at 12:05 PM Já formatei o meu computador e não era do antivirus, só pode ser mesmo da class mailer
MASNathan Posted July 4, 2012 at 12:54 PM Report #467231 Posted July 4, 2012 at 12:54 PM (edited) Creio que o problema não esteja na class mas sim na configuração da firewall do router...Faz assim se não quiseres ter muito trabalho 🙂 faz upload disso para um domínio, se não tiveres nenhum, cria uma conta num gratuito Edited July 4, 2012 at 12:55 PM by MASNathan
Guihgo Posted September 24, 2013 at 08:01 PM Report #525802 Posted September 24, 2013 at 08:01 PM {Resposta - Resolvido AQUI} Olá, estava com o mesmo problema, e vi aqui nesse tópico que não resolveram. Então criei minha conta só pra passar a SOLUÇÃO para vocês e para outros que irão ainda ver esse tópico nesse ótimo Fórum (Portugal-a-Programar). É o seguinte: O GMail esta bloqueando outros aplicativos (clientes) de usarem, por questão de segurança (que acho desnecessário). Então, lá vai a solução simples: 1- Logue em sua conta do Gmail 2- Vá nesse site: https://accounts.google.com/b/0/DisplayUnlockCaptcha 3- Clique em Continuar (Botãozinho Azul) 4- Pronto //-------------------------------------------------------- Espero ter ajudado. Se lhe ajudei, você pode me dizer obrigado. 😉 Qualquer dúvida, agradecimento ou algo do tipo, mande-me mensagem: guihgo100milha@gmail.com Obs.: Sou Brasileiro. Até a próxima. 👍 bY: Guihgo :{)
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now