isedeasy Posted January 27, 2011 Share Posted January 27, 2011 I am using phpmailer to send emails from my site, the problem I have is that when I recieve an email it says its from '[email protected]' not 'websitename'. Why is it not picking up what I pass into $mail->FromName? <?php // from included settings file define ( "SITE_NAME", "websitename" ); define ( "ADMIN_EMAIL", "[email protected]" ); define ( "DOMAIN_NAME", "www.websitename.com" ); define ( "RUN_ON_DEVELOPMENT", TRUE ); define ( "USE_SMTP", TRUE ); define ( "SMTP_PORT", "25" ); define ( "SMTP_HOST", "**************" ); define ( "SMTP_USER", "**************" ); define ( "SMTP_PASS", "**************" ); define ( "MAIL_IS_HTML", TRUE ); //send mail function function send_email ( $subject, $to, $body ) { require ( "classes/class_phpmailer.php" ); $mail = new PHPMailer(); //do we use SMTP? if ( USE_SMTP ) { $mail->IsSMTP(); $mail->SMTPAuth = true; $mail->Host = SMTP_HOST; $mail->Port = SMTP_PORT; $mail->Password = SMTP_PASS; $mail->Username = SMTP_USER; } $mail->From = ADMIN_EMAIL; $mail->FromName = SITE_NAME; // <------------------- Can't get to work $mail->AddAddress( $to ); $mail->AddReplyTo ( ADMIN_EMAIL, DOMAIN_NAME ); $mail->Subject = $subject; $mail->Body = $body; $mail->WordWrap = 100; $mail->IsHTML ( MAIL_IS_HTML ); $mail->AltBody = $body; if ( ! $mail->Send() ) { if ( RUN_ON_DEVELOPMENT ) { echo $mail->ErrorInfo; } return FALSE; } else { return TRUE; } } ?> Link to comment https://forums.phpfreaks.com/topic/225841-phpmailer-fromname-issues/ Share on other sites More sharing options...
isedeasy Posted January 27, 2011 Author Share Posted January 27, 2011 I just realised that the version I am using is well out of date. I will update to the latest version when I get home and see what happens then. Link to comment https://forums.phpfreaks.com/topic/225841-phpmailer-fromname-issues/#findComment-1166045 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.