Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function sendEmail($from, $to, $sub, $body){
- require_once "Mail.php"; //ez a sima pear-es mailer https://pear.php.net/package/Mail
- $host = "smtpszerver";
- $port = "587";
- $username = "username";
- $password = "pass";
- $headers = array (
- 'From' => $from,
- 'To' => $to,
- 'Subject' => $sub,
- 'Content-Type' => "text/plain; charset=UTF-8\r\n"
- );
- $smtp = Mail::factory('smtp',
- array (
- 'host' => $host,
- 'port' => $port,
- 'auth' => true,
- 'username' => $username,
- 'password' => $password,
- 'SMTPSecure' => "tls"
- )
- );
- $mail = $smtp->send($to, $headers, $body);
- if(PEAR::isError($mail)) {
- return $mail->getMessage();
- }else{
- return "Message successfully sent!";
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement