• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
sending mails with authentication

#1
[eluser]stoefln[/eluser]
i tried to send emails with authentication (configured libraries/Email.php: $smtp_host,$smtp_user,$smtp_pass,$_smtp_auth) but then this error occured:
Quote:Message: mail() [function.mail]: SMTP server response: 550 5.7.0 Need to authenticate via SMTP-AUTH-Login {mp038}
Filename: libraries/Email.php
Line Number: 1428
anyone has an idea what i could do to solve this problem?

#2
[eluser]sophistry[/eluser]
post code

#3
[eluser]stoefln[/eluser]
i am using the freakauth library. forgotten password emails are sent in the file Freakauth_light.php

Code:
function _sendEmail($email, $subject, $message)
{
    $tobj =& get_instance();
    $tobj->load->library('email');
    $tobj->email->clear();
    $tobj->email->from($this->CI->config->item('FAL_user_support'), $this->CI->config->item('FAL_website_name').' '.$this->CI->config->item('FAL_email_from'));
    $tobj->email->to($email);
    $tobj->email->subject($subject);
    $tobj->email->message($message);
    $tobj->email->send();
}

i did the configuration directly in the Email.php library of CI:

Code:
class CI_Email {

    var    $useragent        = "CodeIgniter";
    var    $mailpath        = "/usr/sbin/sendmail";    // Sendmail path
    var    $protocol        = "mail";    // mail/sendmail/smtp
    var    $smtp_host        = "mail.gmx.net";        // SMTP Server.
    var    $smtp_user        = "[email protected]";
.....

#4
[eluser]sophistry[/eluser]
ok, well you cut off the code with the password. did you actually submit a password?

#5
[eluser]stoefln[/eluser]
[quote author="sophistry" date="1212868307"]ok, well you cut off the code with the password. did you actually submit a password?[/quote]

i configured the password just the way i did it with the username.

#6
[eluser]sophistry[/eluser]
ok, why don't you post the whole thing? it doesn't help anyone figure out if you are doing something wrong if you cut stuff off.

BTW, the CI email lib supports SMTP AUTH but not using SSL.

#7
[eluser]stoefln[/eluser]
[quote author="sophistry" date="1212882671"]ok, why don't you post the whole thing? it doesn't help anyone figure out if you are doing something wrong if you cut stuff off.

BTW, the CI email lib supports SMTP AUTH but not using SSL.[/quote]

the file is cut off anyway, but i post as much as i can:

[code]<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/**
* CodeIgniter
*
* An open source application development framework for PHP 4.3.2 or newer
*
* @package CodeIgniter
* @author ExpressionEngine Dev Team
* @copyright Copyright © 2006, EllisLab, Inc.
* @license http://ellislab.com/codeigniter/user-guide/license.html
* @link http://codeigniter.com
* @since Version 1.0
* @filesource
*/

// ------------------------------------------------------------------------

/**
* CodeIgniter Email Class
*
* Permits email to be sent using Mail, Sendmail, or SMTP.
*
* @package CodeIgniter
* @subpackage Libraries
* @category Libraries
* @author ExpressionEngine Dev Team
* @link http://ellislab.com/codeigniter/user-gui...email.html
*/
class CI_Email {

var $useragent = "CodeIgniter";
var $mailpath = "/usr/sbin/sendmail"; // Sendmail path
var $protocol = "mail"; // mail/sendmail/smtp
var $smtp_host = "mail.gmx.net"; // SMTP Server. Example: mail.earthlink.net
var $smtp_user = "[email protected]"; // SMTP Username
var $smtp_pass = "test"; // SMTP Password
var $smtp_port = "25"; // SMTP Port
var $smtp_timeout = 5; // SMTP Timeout in seconds
var $wordwrap = TRUE; // TRUE/FALSE Turns word-wrap on/off
var $wrapchars = "76"; // Number of characters to wrap at.
var $mailtype = "text"; // text/html Defines email formatting
var $charset = "utf-8"; // Default char set: iso-8859-1 or us-ascii
var $multipart = "mixed"; // "mixed" (in the body) or "related" (separate)
var $alt_message = ''; // Alternative message for HTML emails
var $validate = FALSE; // TRUE/FALSE. Enables email validation
var $priority = "3"; // Default priority (1 - 5)
var $newline = "\n"; // Default newline. "\r\n" or "\n" (Use "\r\n" to comply with RFC 822)
var $crlf = "\n"; // The RFC 2045 compliant CRLF for quoted-printable is "\r\n". Apparently some servers,
// even on the receiving end think they need to muck with CRLFs, so using "\n", while
// distasteful, is the only thing that seems to work for all environments.
var $send_multipart = TRUE; // TRUE/FALSE - Yahoo does not like multipart alternative, so this is an override. Set to FALSE for Yahoo.
var $bcc_batch_mode = FALSE; // TRUE/FALSE Turns on/off Bcc batch feature
var $bcc_batch_size = 200; // If bcc_batch_mode = TRUE, sets max number of Bccs in each batch
var $_safe_mode = FALSE;
var $_subject = "";
var $_body = "";
var $_finalbody = "";
var $_alt_boundary = "";
var $_atc_boundary = "";
var $_header_str = "";
var $_smtp_connect = "";
var $_encoding = "8bit";
var $_IP = FALSE;
var $_smtp_auth = TRUE;
var $_replyto_flag = FALSE;
var $_debug_msg = array();
var $_recipients = array();
var $_cc_array = array();
var $_bcc_array = array();
var $_headers = array();
var $_attach_name = array();
var $_attach_type = array();
var $_attach_disp = array();
var $_protocols = array('mail', 'sendmail', 'smtp');
var $_base_charsets = array('us-ascii', 'iso-2022-'); // 7-bit charsets (excluding language suffix)
var $_bit_depths = array('7bit', '8bit');
var $_priorities = array('1 (Highest)', '2 (High)', '3 (Normal)', '4 (Low)', '5 (Lowest)');

#8
[eluser]Michael Wales[/eluser]
Are you altering CI's libraries to accomplish this?

I don't want to backtrack all the way through the library to see if it would work in that manner - why not just setup the configuration and initialize the class like the documentation says to?

#9
[eluser]stoefln[/eluser]
[quote author="Michael Wales" date="1212937280"]Are you altering CI's libraries to accomplish this?

I don't want to backtrack all the way through the library to see if it would work in that manner - why not just setup the configuration and initialize the class like the documentation says to?[/quote]

yeah, i think you are right. the problem is that i didnt want to modify the freakauth-lib either. will give it a try...

#10
[eluser]sophistry[/eluser]
i noticed this:
Code:
var $smtp_user = “[email protected]”; // SMTP Username
var $smtp_pass = “test”; // SMTP Password

i've usually seen SMTP passwords use just the mailbox part of the email address - so you might try to use test instead of [email protected]

btw, please post results of your further testing so all may benefit.


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.