0

My WordPress site is hosted on Bluehost which uses a newsletter plugin to send emails http://www.thenewsletterplugin.com/plugins/newsletter

Newsletter Plugin uses PHPMailer to send an email.

The from email address is always username@bluehost.com

I tried all tricks mentioned here Change the sender name php mail instead of sitename@hostname.com but that doesn't work.

When I create and run a standalone PHP page like the below it shows from email address as emailfrom@test.com

<?php

$to      = 'test@test.com';
$subject = 'Test Mail';
$message = 'Test Mail Description';
$headers  = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";


mail($to, $subject, $message, $headers, "-femailfrom@test.com");
?>

But it doenst work with below code.Is there a way to set it up PHP mailer (newsletter plugin) so that it shows the from email to ours, not Bluehost's

I tried changing the header to below but same error.

//$r = $this->mail($user->email, $s, array('html' => $m, 'text' => $mt), $headers);
$r = $this->mail($user->email, $s, array('html' => $m, 'text' => $mt),  null, '-f webmaster@example.com');
//mail('nobody@example.com', 'the subject', 'the message', null, '-f webmaster@example.com');

$status = $r ? 0 : 1;

$wpdb->query($wpdb->prepare("insert into " . $wpdb->prefix . 'newsletter_sent (user_id, email_id, time, status, error) values (%d, %d, %d, %d, %s) on duplicate key update time=%d, status=%d, error=%s', $user->id, $email->id, time(), $status, $this->mail_last_error, time(), $status, $this->mail_last_error));

$this->email_limit--;
Community
  • 1
  • 1
user580950
  • 3,558
  • 12
  • 49
  • 94

0 Answers0