WordPress.org

Ready to get started?Download WordPress

Forums

Navayan Subscribe
Email sent from admin email instead of specified email in settings (1 post)

  1. joseamirandavelez
    Member
    Posted 1 year ago #

    Even though I specify an email in the settings the email is received from the server administrator email. I specified a no-reply email since I dont want people replying to the admin email...

    I edited the code for sending the email replacing adminEmail for my email. I checked all around the code but still the email is received from the admin email... whats happening?

    /***************************************************
    		 * SEND NEW POST NOTIFICATION TO SUBSCRIBERS
    		 * *************************************************/
    		function nys_SendNotification( $post_id = 0 ) {
    			global $wpdb;
    			$post = get_post( $post_id );
    			$subscribersArray = '';
    			$subscriber_email = mysql_query("SELECT user_email
    
    	FROM ". $wpdb->prefix ."users u, ". $wpdb->prefix ."usermeta um
    
    	WHERE um.meta_key='". $wpdb->prefix ."capabilities'
    
    	AND um.meta_value LIKE '%subscriber%'
    
    	AND um.user_id = u.ID ") or die(mysql_error());
    
    			while ($row = mysql_fetch_array($subscriber_email)){
    				$subscribersArray .= $row['user_email'].',';
    			}
    
    			$blogname = stripslashes ( get_option('blogname') );
    			//$adminEmail = get_option('admin_email' );
    			$adminEmail = "no-reply@sociedadastronomia.com";
    			//$from = self::nys_ReplaceSubstitutes( $post->ID, getOption( 'nyEmailFrom', $adminEmail ) );
    			$from = $adminEmail;
    			ini_set("sendmail_from","<$from>");
    			$to = '';
    			//$bcc = substr(  preg_replace( '/[\s]+/', '', $subscribersArray ), 0, -1);
    			$bcc = "dummyemail@gmail.com";
    			$subject	= __( self::nys_ReplaceSubstitutes( $post->ID, getOption( 'nyEmailSubject' ) ) );
    			$headers  = "MIME-Version: 1.0 \r\n";
    			$headers .= "Content-type: text/html; charset=utf-8 \r\n";
    			$headers .= "From: $blogname <$from>\r\n";
    			$headers .= "Bcc: ". $bcc . "\r\n"; // SEND BCC MAIL - IT WILL SAVE TIME AND EXECUTION
    			$mailedBy = "-f $adminEmail";
    			$mailBody = getOption( 'nyEmailBody' );
    			$mailBody = str_replace('{POST_FEATURED_IMAGE}', self::nys_FeaturedImage( $post->ID ), $mailBody ); // FEATURED POST 
    
    IMAGE
    
    			$message = "<!DOCTYPE html>
    									<html>
    										<head><title>". $blogname ."</title></head>
    										<body style='margin: 20px'>"
    											. __( self::nys_ReplaceSubstitutes( $post->ID, 
    
    $mailBody ) ) ."
    										</body>
    									</html>";
    			return @wp_mail( $to, $subject, $message, $headers, $mailedBy );
    		}
    
    	}
    
    	// MADE CLASS NYS_FIELDS GLOBAL TO AVOID ITERATIONS
    	$class_NYS_FIELDS = class_exists('NYS_FIELDS') ? new NYS_FIELDS : exit( coreNotFound() );
    	global $class_NYS_FIELDS;

    http://wordpress.org/extend/plugins/navayan-subscribe/

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

  • RSS feed for this topic
  • Started 1 year ago by joseamirandavelez
  • This topic is not resolved
  • WordPress version: 3.5