Welcome Guest, Not a member yet? Register   Sign In
Email problems
#1

[eluser]the future darlo manager[/eluser]
Hi guys, my latest problem is with sending e-mails... I've used the code from the userguide but don't appear to be getting anywhere.

Code:
//Sets up and sends the welcome email
$this->email->from('[email protected]', 'No reply at my addy.com');
$this->email->to('$email');
$this->email->subject('Welcome to BSL 101 on-line Resource');
$this->email->message('Testing the email class.');
$this->email->send();
echo $this->email->print_debugger();

All I get is the following error.

A PHP Error was encountered

Severity: Warning

Message: mail() [function.mail]: SMTP server response: 501 5.5.4 Invalid Address

Filename: libraries/Email.php

Line Number: 1428

I can run a normal php mail() elsewhere on my xampp windows server but not inside this controller or anywhere else inside inside this codeigniter install. Not too sure what to do at the moment.
#2

[eluser]Tom Glover[/eluser]
Have you set the email config, in the controller you are using? you may have to use smpt locally in windows, but that should work fine on *nix.
#3

[eluser]the future darlo manager[/eluser]
Just set up the config above the actual e-mail send out. I dived into my php.ini file to get this information as clearly it is working for my standard e-mails out side of CI. This time I get a timeout error after 60 seconds. However I'm still confused as to why it ain't working when a mail() works quite happily.

Code:
$config['protocol'] = 'smtp';
$config['smtp_host'] = 'exchange.ca2domain.local';
$config['smtp_port'] = '25';
$config['charset'] = 'iso-8859-1';
$config['wordwrap'] = TRUE;
$this->email->initialize($config);
#4

[eluser]the future darlo manager[/eluser]
Apologies, the error I'm actually getting now is...

Fatal error: Maximum execution time of 60 seconds exceeded in C:\xampp\htdocs\learning-support\system\libraries\Email.php on line 1704
#5

[eluser]the future darlo manager[/eluser]
Anyone any suggestions?
#6

[eluser]eilrahc[/eluser]
In your first post, you said you got this error message:

"Message: mail() [function.mail]: SMTP server response: 501 5.5.4 Invalid Address"

This is the response that the remote mail server gave back to your script. It's Microsoft Exchange SMTP error message telling you that the program sending the email didn't properly identify itself during the handshake (specifically, the HELO/EHLO command). If you have access to the mail server, take a look at the logs and see what it's using. It can only be "HELO hostname.example.com" with the fully-qualified hostname and no trailing periods or spaces.

Have a look at this MS KB article for more info: http://support.microsoft.com/kb/291828
#7

[eluser]the future darlo manager[/eluser]
Cheers for the reply, will have a look into that. I come from a shared hosting background so have never had to worry about about mail servers etc. Anyway, I've found this morning that if I strip out the mail reference in my libraries autoloader the standard php mail function works again. So at least I have a solution now. I will perverse though with the CI mail sending but its nice to know I can fall back.
#8

[eluser]ErwinVanHoof[/eluser]
Hi there,

I think I found your problem

Have a look at this line:

Code:
$this->email->to('$email');

Shouldn't that be:

Code:
$this->email->to("$email");

or

$this->email->to($email);

else the email address will litteraly be '$email'




Theme © iAndrew 2016 - Forum software by © MyBB