Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- SMTP = smtp.example.com
- smtp_port = 25
- username = info@example.com
- password = yourmailpassord
- sendmail_from = info@example.com
- smtp_server=smtp.gmail.com
- smtp_port=465
- auth_username=user@gmail.com
- auth_password=your_password
- [mail function]
- ; For Win32 only.
- SMTP = mail.yourserver.com
- smtp_port = 25
- auth_username = smtp-username
- auth_password = smtp-password
- sendmail_from = you@yourserver.com
- <?php
- $message = "test message body";
- $result = mail('recipient@some-domain.com', 'message subject', $message);
- echo "result: $result";
- ?>
- #Relay config
- relayhost = smtp.server.net
- smtp_use_tls=yes
- smtp_sasl_auth_enable=yes
- smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
- smtp_tls_CAfile = /etc/postfix/cacert.pem
- smtp_sasl_security_options = noanonymous
- smtp.server.net username:password
- composer require phpmailer/phpmailer
- # use namespace
- use PHPMailerPHPMailerPHPMailer;
- # require php mailer
- require_once "../vendor/autoload.php";
- //PHPMailer Object
- $mail = new PHPMailer;
- //From email address and name
- $mail->From = "from@yourdomain.com";
- $mail->FromName = "Full Name";
- //To address and name
- $mail->addAddress("recepient1@example.com", "Recepient Name");
- $mail->addAddress("recepient1@example.com"); //Recipient name is optional
- //Address to which recipient will reply
- $mail->addReplyTo("reply@yourdomain.com", "Reply");
- //CC and BCC
- $mail->addCC("cc@example.com");
- $mail->addBCC("bcc@example.com");
- //Send HTML or Plain Text email
- $mail->isHTML(true);
- $mail->Subject = "Subject Text";
- $mail->Body = "<i>Mail body in HTML</i>";
- $mail->AltBody = "This is the plain text version of the email content";
- if(!$mail->send())
- {
- echo "Mailer Error: " . $mail->ErrorInfo;
- }
- else
- {
- echo "Message has been sent successfully";
- }
Add Comment
Please, Sign In to add comment