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 'adminemail@websitename.com' 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", "adminemail@websitename.com" ); 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; } } ?> Quote 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. Quote Link to comment https://forums.phpfreaks.com/topic/225841-phpmailer-fromname-issues/#findComment-1166045 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.