views:

148

answers:

3

I have setup a mail sender with the Codeigniter email library.

Everything works fine until a user specifies a gmail or hotmail address as their address.

eg

$email = $this->input->post('[email protected]');

This is just a return address for me to reply to. The email itself is sent from a Godaddy email account.

Im wondering if anyone has had similar issues with codeigniter email library or Godaddy hosting where simply specifying a email return address causes messages to not be delivered.

The debugger shows no errors when the form is submitted. If I change the value of the users email address just before sending the email eg. string replace gmail to xgmail the mail is sent flawlessly.

Here is my config array

'protocol' => 'sendmail',
'smtp_host' => 'smtpout.secureserver.net',
'smtp_port' => 25,
'smtp_user' => '[email protected]',
'smtp_pass' => 'password',
'mailtype' => 'text');

Ive tried a gmail and godaddy as smtp_hosts. Both times when

$email = $this->input->post('email');

is a gmail or hotmail address the mail never gets delivered.

Ive combed the net for answers but cant seem to find any similar problems.

EDIT:tried to make clearer.

A: 

It doesn't get sent Or doesn't get delivered ? Two different things.

If it doesn't get delivered, gmail / hotmail spam filters might be filtering out your email. Did you check your SPAM Inbox ?

If it doesn't get sent, the email might not be correct ? What is the return SMTP reply code ? is it 5xx ?

I wanted to comment, instead of "Answer" but apparently I can't yet. (sorry)

Stewie
Seems to just not get delivered. No errors. The weird thing is the email address users input is just the email to reply to. Not the email address the emails are sent from.
chris
A: 

OK, you try to send emails via the Gmail SMTP server, but you have set the protocol wrong. Set the protocol to smtp, and set the hostname and port accordingly.

Residuum
cuz right now its setup for Godaddy email.
chris
its confusing to explain. All the user email address is is a field that identifies their own email. The email gets sent from my address to my address but for some reason what they indicate as their own email is affecting message delivery...
chris
Perhaps the SMTP server of Gmail and sendmail of Godaddy accept all emails, but do not relay the emails to the respective host. Can you setup some other mail server for reference, any server will do, afaik even XAMPP can be setup as mail server.
Residuum
A: 

I had the same problem and after a lot of searching I finally found the solution. These configuration settings work for me:

$config['crlf'] = "\r\n";
$config['newline'] = "\r\n";
$config['protocol'] = 'smtp';
$config['smtp_host'] = 'relay-hosting.secureserver.net';
$config['smtp_port'] = '25';
$config['mailtype'] = 'html';

Note: it is not necessary to provide username and password. Make sure the email you are sending does not contain too many links. It will be marked as spam by GoDaddy's mailserver.

If it still doesn't work with these settings, use the print_debugger to see the exact response from the mail server:

$this->email->send();
echo $this->email->print_debugger();
exit;
captaintokyo