Part of the EllisLab Network
   
1 of 2
1
SMTP authentification miss a parameter?
Posted: 12 May 2008 12:18 PM   [ Ignore ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  665
Joined  04-20-2006

Hi,

I get a problem sending email with the email library (CI SVN latest)
I am sure that all my parameters are correct and double checked all my code, but I get the following:

from: 250 OK
to
: 550 relay not permitted, authentication required

I was asking myself about a possible missing parameter in the email library. I say this because for example I must activate the option “My Server requires an authentication” in my email program and I didn’t find in email library such an option.

What’s your thought about this?

 Signature 

All CodeIgniter resources in 1 place?
http://www.codeigniterdirectory.com (Did you know we are converting this directory to Linkster? We need a Graphic designer, join us!)

My website: Création de sites Genève, Too Pixel

Profile
 
 
Posted: 12 May 2008 01:18 PM   [ Ignore ]   [ # 1 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  667
Joined  08-06-2006

does this feature request sound like what you are looking for. i found it searching on SMTP Auth

Profile
 
 
Posted: 12 May 2008 01:22 PM   [ Ignore ]   [ # 2 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  665
Joined  04-20-2006

I’ve found it too but didn’t understood what this guy was meaning… then I preferred to post again.

Actually this is not a feature request, I personally define it as a bug because the email library should handle the SMTP authentication correctly.

 Signature 

All CodeIgniter resources in 1 place?
http://www.codeigniterdirectory.com (Did you know we are converting this directory to Linkster? We need a Graphic designer, join us!)

My website: Création de sites Genève, Too Pixel

Profile
 
 
Posted: 12 May 2008 01:25 PM   [ Ignore ]   [ # 3 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  667
Joined  08-06-2006

well, he’s asking for SSL support to talk to gmail. is that what you are after? or is there something missing with the basic auth user/pass SMTP auth in the email class?

Profile
 
 
Posted: 12 May 2008 01:29 PM   [ Ignore ]   [ # 4 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  665
Joined  04-20-2006

I don’t think this have something to do with SSL, but it seems that there is a missing parameter like I tried to explain in my first post.

 Signature 

All CodeIgniter resources in 1 place?
http://www.codeigniterdirectory.com (Did you know we are converting this directory to Linkster? We need a Graphic designer, join us!)

My website: Création de sites Genève, Too Pixel

Profile
 
 
Posted: 12 May 2008 01:31 PM   [ Ignore ]   [ # 5 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  667
Joined  08-06-2006

AFAICT - there is a basic auth option in the email class - check the manual page here

Profile
 
 
Posted: 12 May 2008 01:41 PM   [ Ignore ]   [ # 6 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  665
Joined  04-20-2006

Thanks for trying to help but I already know this and use it.
I will try to explain more precisly what is the problem:

Take for example this library:
http://phpmailer.codeworxtech.com/index.html

There is a specific option like in all email clients (like Outlook, Thunderbird, ...) to specify that the server requires an authentification. This is in case we use SMTP out of the server itself. The CI lib don’t have such an option and this is needed for some hosts.

For the above library, you can see it here:
http://phpmailer.codeworxtech.com/properties.html

$SMTPAuth : Sets SMTP authentication. Utilizes the Username and Password variables.

I’ve tried it, without this option I get the same error as CI Email library and while setting this option simply to True, the emails are outgoings.

Hope I’ve been more complete in my explanation now.

 Signature 

All CodeIgniter resources in 1 place?
http://www.codeigniterdirectory.com (Did you know we are converting this directory to Linkster? We need a Graphic designer, join us!)

My website: Création de sites Genève, Too Pixel

Profile
 
 
Posted: 12 May 2008 01:47 PM   [ Ignore ]   [ # 7 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  667
Joined  08-06-2006

thanks for the “complete” explanation. grin i still think you need to look at the manual page. i think you will find your solution there…

allow me to quote it so as to whet your appetite:

Email Preferences
The following is a list of all the preferences that can be set when sending email.

Preference   Default Value   Options   Description
useragent   CodeIgniter   None   The “user agent”.
protocol   mail   mail, sendmail, or smtp   The mail sending protocol.
mailpath   /usr/sbin/sendmail   None   The server path to Sendmail.
smtp_host   No Default   None   SMTP Server Address.
smtp_user   No Default   None   SMTP Username.
smtp_pass   No Default   None   SMTP Password.
smtp_port   25   None   SMTP Port.
smtp_timeout   5   None   SMTP Timeout (in seconds).

——SNIP——

Profile
 
 
Posted: 12 May 2008 02:12 PM   [ Ignore ]   [ # 8 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  665
Joined  04-20-2006

Sorry but I have told you twice that I checked all my parameters + that I already use the built in authentification, so don’t you think I have tried what you are quoting already?

 Signature 

All CodeIgniter resources in 1 place?
http://www.codeigniterdirectory.com (Did you know we are converting this directory to Linkster? We need a Graphic designer, join us!)

My website: Création de sites Genève, Too Pixel

Profile
 
 
Posted: 12 May 2008 02:13 PM   [ Ignore ]   [ # 9 ]  
Administrator
Avatar
RankRankRankRankRankRankRank
Total Posts:  15291
Joined  06-03-2002

Indeed, the SMTP connection support authentication if a user and password are provided.  It does not, however, support SSL.

 Signature 
Profile
MSG
 
 
Posted: 12 May 2008 02:19 PM   [ Ignore ]   [ # 10 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  667
Joined  08-06-2006

post code.

Profile
 
 
Posted: 12 May 2008 02:35 PM   [ Ignore ]   [ # 11 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  665
Joined  04-20-2006

I will try to reconstruct the code part that may cause the problem, (actually this is in several files):

In a config file:

define('MAIL_SITE', 'christophe@mydomain.com');
define('SMTP_HOST', 'mail.mydomain.com');
define('SMTP_USER', 'my_smtp_user'); // Real username and password in my scripts are correct and I am sure about it
define('SMTP_PASS', 'my_smtp_pass');
define('SMTP_PORT', 587); // I am sure about this, don't ask me why the port is not 25

Then this config file is loaded in a library that do this:

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

// Set the default email config and Initialize
$config['protocol']  = 'smtp';
$config['smtp_host'] = SMTP_HOST;
$config['smtp_user'] = SMTP_USER;
$config['smtp_pass'] = SMTP_PASS;
$config['smtp_port'] = SMTP_PORT;
$config['mailtype']  = 'html';
        
$this->email->initialize($config);

$this->email->from('me@test.com', 'Sender Name');
$this->email->to(MAIL_SITE);
$this->email->subject('Email Test');
$this->email->message('Testing the email class.');

if( !
$this->CI->email->send())
{
    
echo $this->email->print_debugger();
}
else
{
    
echo "Email sent";
}

 Signature 

All CodeIgniter resources in 1 place?
http://www.codeigniterdirectory.com (Did you know we are converting this directory to Linkster? We need a Graphic designer, join us!)

My website: Création de sites Genève, Too Pixel

Profile
 
 
Posted: 12 May 2008 02:39 PM   [ Ignore ]   [ # 12 ]  
Administrator
Avatar
RankRankRankRankRankRankRank
Total Posts:  15291
Joined  06-03-2002

Port 587 is SMTP with STARTTLS, i.e. it’s using SSL.

 Signature 
Profile
MSG
 
 
Posted: 12 May 2008 02:41 PM   [ Ignore ]   [ # 13 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  665
Joined  04-20-2006

mmm, ok I see. So this is a feature request then and not anymore a bug.

 Signature 

All CodeIgniter resources in 1 place?
http://www.codeigniterdirectory.com (Did you know we are converting this directory to Linkster? We need a Graphic designer, join us!)

My website: Création de sites Genève, Too Pixel

Profile
 
 
Posted: 12 May 2008 02:41 PM   [ Ignore ]   [ # 14 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  667
Joined  08-06-2006

hmmmnnn, interesting. port 587? i googled smtp port 587 and found rfc2476 which says some things about how these types of mailservers (listening on port 587) can be configured:

http://www.ietf.org/rfc/rfc2476.txt

3.2.  Message Rejection and Bouncing

  MTAs and MSAs MAY implement message rejection rules that rely in part
  on whether the message is a submission or a relay.

  For example, some sites might configure their MTA to reject all RCPT
  TOs for messages that do not reference local users, and configure
  their MSA to reject all message submissions that do not come from
  authorized users, based on IP address, or authenticated identity.

  NOTE:  It is better to reject a message than to risk sending one that
  is damaged.  This is especially true for problems that are
  correctable by the MUA, for example, an invalid ‘From’ field.

  If an MSA is not able to determine a return path to the submitting
  user, from a valid MAIL FROM, a valid source IP address, or based on
  authenticated identity, then the MSA SHOULD immediately reject the
  message.  A message can be immediately rejected by returning a 550
  code to the MAIL FROM command.

does that sound familiar?

so, who is running your mailserver? can you get the log to see what it says there?

Profile
 
 
Posted: 12 May 2008 02:43 PM   [ Ignore ]   [ # 15 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  667
Joined  08-06-2006

so it was SSL all along… that’s why posting code up front is better. wink

Profile
 
 
   
1 of 2
1
 
Post Marker Legend
New Topic New posts Hot Topic Hot Topic with new posts New Poll New Poll Moved Topic Moved Topic Sticky Topic Sticky topic
Old Topic No new posts Hot Old Topic Hot Topic with no new posts Old Poll Old Poll Closed Topic Closed Topic Announcement Announcements
Theme
Change Theme
Visitor Statistics
The most visitors ever was 719, on June 06, 2008 10:16 AM
Total Registered Members: 62653 Total Logged-in Users: 33
Total Topics: 77188 Total Anonymous Users: 0
Total Replies: 416685 Total Guests: 227
Total Posts: 493873    
Members ( View Memberlist )