In PHP on Microsoft Windows you have to simply configure two parameters to enable sending mails through SMTP server. Em PHP em Microsoft Windows que você tem que simplesmente configurar dois parâmetros a fim de permitir enviar mails através do servidor SMTP. In Unix / Linux it is slightly more complicated. Em Unix / Linux é um pouco mais complicada. The solution, however, is much more powerful and works also on Windows. A solução, porém, é muito mais poderosa e também funciona no Windows. Let’s first start with Windows. Vamos começar com o primeiro Windows.

In Microsoft Windows PHP installation you just have to change two variables in php.ini: No Microsoft Windows PHP instalação você só tem que mudar no php.ini duas variáveis:

SMTP = smtp.server.com SMTP = smtp.server.com
smtp_port = 25 smtp_port = 25

Replace smtp.server.com with your SMTP server name and 25 with your SMTP server port (normally 25). Substituir smtp.server.com com o servidor SMTP 25, com o seu nome e porta do servidor SMTP (normalmente 25).

You can also set the default sender information in Windows: Você também pode definir o padrão remetente informações no Windows:
sendmail_from = me@example.com sendmail_from = me@example.com

On Linux / Unix PHP relies on sendmail . Em Linux / Unix PHP assenta na sendmail. You can specify the sendmail path here: Você pode especificar o caminho sendmail aqui:
sendmail_path = /usr/sbin/sendmail -t -i sendmail_path = / usr / sbin / sendmail-t-i

Unfortunately this doesn’t work too well if your SMTP server is configured on a different machine or you are not using sendmail. Infelizmente isso não funcionar muito bem se o seu servidor SMTP é configurado em uma outra máquina ou você não está usando o sendmail.

PHPMailer Fortunately there is a much better solution in Felizmente há uma solução muito melhor em PHPMailer . The default mail capability provided by mail() function in PHP is very limited. O padrão capacidade mail fornecido pelo correio (), em função do PHP é muito limitada. PHPMailer is a full fledged mail API which can be used to do any kind of mailing tasks. PHPMailer é uma verdadeira mail API, que pode ser usado para fazer qualquer tipo de mailing tarefas.

Features of PHPMailer Características do PHPMailer

  1. Can send emails with multiple TOs, CCs, BCCs and REPLY-TOs Pode enviar e-mails com múltiplos OT, MCs, BCCs e responder-OT
  2. Redundant SMTP servers Redundante servidores SMTP
  3. Multipart/alternative emails for mail clients that do not read HTML email Multipart / alternative mail e-mails para clientes que não ler e-mails HTML
  4. Support for 8bit, base64, binary, and quoted-printable encoding Suporte para 8bit, base64, binário, e citou-printable encoding
  5. Uses the same methods as the very popular AspEmail active server (COM) component Utiliza os mesmos métodos como o muito popular servidor AspEmail activa (COM) componente
  6. SMTP authentication Autenticação SMTP
  7. Word wrap Palavra embrulhar
  8. Address reset functions Endereço redefinir funções
  9. HTML email HTML e-mail
  10. Tested on multiple SMTP servers: Sendmail, qmail, Postfix, Imail, Exchange, etc Testado em múltiplos servidores SMTP: Sendmail, qmail, Postfix, Imail, Exchange, etc
  11. Works on any platform Funciona em qualquer plataforma
  12. Flexible debugging Flexível depuração
  13. Custom mail headers Custom mail cabeçalhos
  14. Multiple fs, string, and binary attachments (those from database, string, etc) Múltiplas fs, corda, e os acessórios binários (aqueles a partir de banco de dados, string, etc)
  15. Embedded image support Embutidos imagem apoio

How to use PHPMailer Como usar PHPMailer
To use PHPMailer you need to first Para utilizar PHPMailer você precisa primeiro download the files download dos arquivos and save the relevant files (upload) on your server. e salvar os arquivos (upload) em seu servidor.

You need to upload class.phpmailer.php , class.smtp.php (for SMTP support) and language/phpmailer.lang-en.php . Você precisa fazer o upload class.phpmailer.php, class.smtp.php (SMTP para suporte) e de idioma / phpmailer.lang-en.php. You should download the lang file corresponding to the language of your blog. Você deve fazer o download do arquivo lang correspondente ao idioma do seu blog. For my english language sites I use language/phpmailer.lang- en .php , where en is the language code. Para o meu idioma Inglês sites eu uso language/phpmailer.lang- en. Php, onde é a língua en código.

In your PHP file include class.phpmailer.php as follows: Em seu arquivo PHP class.phpmailer.php incluem o seguinte:

 if(!class_exists('PHPMailer')) {     require(BASEPATH . '/class.phpmailer.php'); } if (! class_exists ( 'PHPMailer')) (exigir (BASEPATH '. / class.phpmailer.php');) 

Replace BASEPATH with the actual path of class-phpmailer.php file. Substituir BASEPATH com o próprio caminho de classe-phpmailer.php arquivo. You may also define BASEPATH to achieve the same result (preferred). Você também pode definir BASEPATH para atingir o mesmo resultado (de preferência).

Note: This check ensures only one copy of the class is loaded. Nota: Este controlo assegura apenas uma cópia da classe é carregada. This in turn loads other required classes. Este, por sua vez, carrega outros exigidos classes.

Now you can send a mail using any SMTP server. Agora você pode enviar um email usando qualquer servidor SMTP. Here is a simple example: Aqui está um exemplo simples:

 $mail = new PHPMailer();  $mail->From     = $senderemail; $mail->FromName = $sendername; $mail->AddAddress($receiveremail, $receivername); // Fill in Username and Password for servers requiring authentication $mail->Username = $smtp_username; $mail->Password = $smtp_password;  // SMTP server name $mail->Host     = $smtp_server; $mail->Mailer   = "smtp";  $mail->Subject = $mail_subject; $mail->Body    = $mail_body;  if(!$mail->Send()) $results = 'Error message'; else $results = 'Success message'; $ mail = new PHPMailer (); $ mail-> De = $ senderemail; $ mail-> FromName = $ sendername; $ mail-> AddAddress (US $ receiveremail, US $ receivername) / / Preencha o nome de usuário e senha para servidores que exigem autenticação $ mail-> Username = $ smtp_username; $ mail-> Password = $ smtp_password; / / nome do servidor SMTP $ mail-> Host = $ smtp_server; $ mail-> Mailer = "smtp"; $ mail-> Subject = $ mail_subject ; $ Mail-> Body = $ mail_body; if (! US $ mail-> Envia ()) $ resultados = 'Mensagem de erro'; resto $ resultados = 'Sucesso mensagem'; 

You can read the Você pode ler o documentation Documentação , De advanced example avançadas exemplo or the ou o tutorial if you need further help. se precisar de mais ajuda.