Welcome Guest, Not a member yet? Register   Sign In
Error in setting up subject line for emails
#1

[eluser]Unknown[/eluser]
Dear all,

I am using email library for sending emails. Following is my code

$this->load->library('email');

$config['wordwrap'] = TRUE;
$config['mailtype'] = 'text';
$config['charset'] = 'iso-8859-1';

$this->email->initialize($config);

$this->email->from('someemail@website.com', 'Some Admin');
$this->email->to($email);

$subj = $sender_name + " has sent you a message";
$message = "Hello";
$this->email->subject("$subj");
$this->email->message($message);
$this->email->send();

The email is sent, but the subject line is 0. Nothing else but a zero. When I remove the $sender_name variable from the subject and just give a plain text, then the subject appears without issue.

Could someone please help me resolve this issue to make the sender name from php variable available in the subject line.

Thanks,
smachohalla


#2

[eluser]noideawhattotypehere[/eluser]
Php concatenation is a dot (.), not plus (+)

PS: Sometimes you wrap variables into "" sometimes not, you should stick to one way. And remember that variables in " " will be parsed by php while these in ' ' will output exactly what you put in them.
#3

[eluser]Unknown[/eluser]
Thank you very much for the input.

It was silly on my part. Smile

smachohalla




Theme © iAndrew 2016 - Forum software by © MyBB