How to set the name of sender in the From field

Swift Mailer is a fantastic library for sending email with php. Discuss this library or ask any questions about it here.

Moderators: Chris Corbyn, General Moderators

Post Reply
parka
Forum Commoner
Posts: 52
Joined: Mon Feb 26, 2007 6:48 am

How to set the name of sender in the From field

Post by parka »

Hi all,

I've a hosting account with bluehost.com. They are sending out my emails but the From field isn't what I expected.

It's something like this.
from example1@example.bluehost.com
reply-to Name of Sender <admin@example.com>
to recipient@gmail.com
date Sun, Oct 19, 2008 at 12:45 AM
subject Subject title for email (testing)
mailed-by example.bluehost.com
When I tested it on my localhost home server, it was like this, which is what I need.
from Name of Sender <admin@example.com>
reply-to Name of Sender <admin@example.com>
to recipient@gmail.com
date Sun, Oct 19, 2008 at 12:45 AM
subject Subject title for email (testing)
I'm using the following code.

Code: Select all

$sSwiftSender = new Swift_Address('admin@example.com', 'Name of Sender');
    
$swift->send($message, 'recipient@gmail.com', $sSwiftSender)
Is there anyway to configure the From field? Or this is it, the From field is controlled by my web host (bluehost.com)?
parka
Forum Commoner
Posts: 52
Joined: Mon Feb 26, 2007 6:48 am

Re: How to set the name of sender in the From field

Post by parka »

Ok. I've solve it.

It was because I haven't created that email account, so it doesn't exists, and that's why it was using my web host's email address.
Post Reply