You can set up a default newsletter sender (name and email) in plugin settings.
Then, if you like to use the newsletter author info (name and email), you can paste this code (where?):
function my_easymail_headers_author ( $headers, $newsletter ) {
$user_info = get_userdata( $newsletter->post_author );
$from_name = $user_info->user_login; // or: $user_info->user_firstname, $user_info->user_lastname...
$mail_sender = $user_info->user_email;
$headers = "From: ". $from_name ." <".$mail_sender.">\n";
$headers .= "Content-Type: text/html; charset=\"" . strtolower( get_option('blog_charset') ) . "\"\n";
return $headers;
}
add_filter( 'alo_easymail_newsletter_headers', 'my_easymail_headers_author', 10, 2 );
It worked for me, I hope it helps you.
Thread Starter
Chris
(@comradeseidl)
Thanks for the rapid response! However, I should have been more clear with my question; sorry about that.
When publishing newsletters as blog posts, I would like to be able to attribute the newsletters to a different user account (author) just like I can when publishing a blog post.
Ok, I understand.
You can use this line:
add_post_type_support( 'newsletter', 'author' );
Now the “Author” meta box should appear in newsletter edit screen. I hope it helps you.
Thread Starter
Chris
(@comradeseidl)
Excellent, I figured there was a function out there for this but didn’t know the name. Thanks. 🙂 #resolved
PS love the plugin. I think it lacks some good features, for example I don’t think the gallery support is that great and it would be easier if the template allowed for some kind of dynamic design, because right now I am having to custom design the HTML for our emails to get them looking like I want. I eventually plan on writing a little HTML generation page with an option to choose single-column or multi-column so that I can switch up newsletter formats for our readers. I can’t promise my code will be up to par with cleanliness and best practices but it will get the job done; I can PM you the code when it’s finished if you want, but this is a project that I am putting on the backburner for the time being. Thanks again and sorry for the tldr.