Quantcast
Channel: Tópicos
Viewing all articles
Browse latest Browse all 11336

Config Email

$
0
0
Boas pessoal. Estive aqui a tentar criar uma pequena aplicação em PHP e usei a framework Slim. É uma coisa muito básica onde o utilizador pode-se registar, e a quando do registo supostamente deveria receber um email a dizer que se registou. Ora muito bem, aqui é que estou com dificuldades. O utilizador é criado com sucesso, mas o email não vai. A função send é a seguinte <?php public function send($template, $data, $callback) { $message = new Message($this->mailer); $this->view->appendData($data); $message->body($this->view->render($template)); call_user_func($callback, $message); $this->mailer->send(); var_dump($this->mailer->send()); die(); } ?> Quando adicionei o var_dump o erro que dá é bool(false) Como "tira teimas" criei um outro ficheiro fora deste projeto e meti o mais básica código para enviar emails (Obviamente alterei os emails para colocar aqui) <?php ini_set("SMTP","smtp.gmail.com" ); $Name = "Sender"; $email = "sender@mail.com"; $recipient = "receiver@mail.com"; $mail_body = "The text for the mail..."; $subject = "Subject for reviever"; $header = "From: ". $Name . " <" . $email . ">\r\n"; mail($recipient, $subject, $mail_body, $header); ?> no meu php.ini tenho a seguinte configuração para a parte do mail [mail function] ; For Win32 only. ; http://php.net/smtp SMTP = smtp.gmail.com ; http://php.net/smtp-port smtp_port = 587 ; For Win32 only. ; http://php.net/sendmail-from ;sendmail_from = me@example.com ; For Unix only. You may supply arguments as well (default: "sendmail -t -i"). ; http://php.net/sendmail-path ;sendmail_path = ; Force the addition of the specified parameters to be passed as extra parameters ; to the sendmail binary. These parameters will always replace the value of ; the 5th parameter to mail(). ;mail.force_extra_parameters = ; Add X-PHP-Originating-Script: that will include uid of the script followed by the filename mail.add_x_header = On ; The path to a log file that will log all mail() calls. Log entries include ; the full path of the script, line number, To address and headers. ;mail.log = ; Log mail to syslog (Event Log on Windows). ;mail.log = syslog quando executo o mail.php aparece-me este erro Warning: mail(): SMTP server response: 530 5.7.0 Must issue a STARTTLS command first. m194sm24421424wmg.11 - gsmtp in C:\WebServer\Apache24\htdocs\html\www\mail.php on line 12 Instalei PHP, MySQL, Apache e phpMyAdmin tudo em separado. Podem dar uma ajuda?

Viewing all articles
Browse latest Browse all 11336

Trending Articles