Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

phpmailer --> help :(

  • 23-06-2006 9:03pm
    #1
    Registered Users, Registered Users 2 Posts: 1,521 ✭✭✭


    Hyia; I'm building a site for a friend and well im clueless as to how to get the mail/registration working.

    Im using CPG-Dragonfly 9.0.6.1 http://www.cpgnuke.com/

    I have either the option to use SMTP or PHPMAILER but I dunno where to start or what to do. And yes Vengeance I have searched their forums and and low for a guide. I was hoping to use Gmail as the SMTP server but have no idea where to start or what to do, if you know how or know where I can learn how I'd greatly appreciate it:

    MSN me @ joseph_mountain_9@Hotmail.com
    Or reply here Smile
    (Or xfire: joseph4)

    Thanks in advance,
    Joseph.


Comments

  • Registered Users, Registered Users 2 Posts: 3,514 ✭✭✭Rollo Tamasi


    incoming server : pop.gmail.com
    out going server :smtp.google.com
    username : yournam @ gmail .com
    password : your current password

    you're going to be using port 587 or 25 if it asks

    what exactly is happening? I presume you have a install screen in front of you which is requesting your site name and db info and all that?


  • Registered Users, Registered Users 2 Posts: 1,521 ✭✭✭Joseph


    I have these settings available to me:

    "Allow the use of HTML in email Yes/No
    Use SMTP server as opposed to PHP's mailer Yes/No
    SMTP host address (smtp.host.tld) : ____________
    Does server require SMTP authorization Yes/No
    SMTP username: __________
    SMTP password: __________
    "

    Is the SMTP host address the incoming or outgoing? Do I need to edit something in phpmailer.php?


  • Registered Users, Registered Users 2 Posts: 1,521 ✭✭✭Joseph


    I also have these settings (I think) in the file phpmailer.php. (there is loads more settings but this is the SMTP section afaik)

    "[PHP] /////////////////////////////////////////////////
    // SMTP VARIABLES
    /////////////////////////////////////////////////

    /**
    * Sets the SMTP hosts. All hosts must be separated by a
    * semicolon. You can also specify a different port
    * for each host by using this format: [hostname:port]
    * (e.g. "smtp1.example.com:25;smtp2.example.com").
    * Hosts will be tried in order.
    * @var string
    */
    var $Host = '';

    /**
    * Sets the default SMTP server port.
    * @var int
    */
    var $Port = 25;

    /**
    * Sets the SMTP HELO of the message (Default is $Hostname).
    * @var string
    */
    var $Helo = '';

    /**
    * Sets SMTP authentication. Utilizes the Username and Password variables.
    * @var bool
    */
    var $SMTPAuth = false;

    /**
    * Sets SMTP username.
    * @var string
    */
    var $Username = '';

    /**
    * Sets SMTP password.
    * @var string
    */
    var $Password = '';

    /**
    * Sets the SMTP server timeout in seconds. This function will not
    * work with the win32 version.
    * @var int
    */
    var $Timeout = 10;

    /**
    * Sets SMTP class debugging on or off.
    * @var bool
    */
    var $SMTPDebug = false;

    /**
    * Prevents the SMTP connection from being closed after each mail
    * sending. If this is set to true then to close the connection
    * requires an explicit call to SmtpClose().
    * @var bool
    */
    var $SMTPKeepAlive = false;

    /**#@+
    * @access private
    */
    var $smtp = NULL;
    var $to = array();
    var $cc = array();
    var $bcc = array();
    var $ReplyTo = array();
    var $attachment = array();
    var $CustomHeader = array();
    var $message_type = '';
    var $boundary = array();
    var $language = array();
    var $error_count = 0;
    var $LE = "\n";
    /**#@-*/[/PHP]
    "

    :confused::confused::confused:


  • Registered Users, Registered Users 2 Posts: 3,514 ✭✭✭Rollo Tamasi


    [PHP]var $Host = 'smtp.gmail.com';
    var $Port = 25;
    var $Helo = 'gmail.com'; // or smtp.gmail.com
    var $SMTPAuth = true;
    var $Username = 'email@gmail.com';
    var $Password = 'email_password';
    var $Timeout = 10;
    var $SMTPDebug = false;
    var $SMTPKeepAlive = false; [/PHP]

    Try these variables. Not 100% sure on the $Helo variable. If you read the comments (the orange text) they give good indicators as to what you need to put into the 'area', there is nothing too confusing there.
    CPG-Dragonfly surely has a install manual and/or support forum too.


  • Registered Users, Registered Users 2 Posts: 1,521 ✭✭✭Joseph


    "New User Account Created!

    Welcome! You are now registered as a member

    Your request for a new account has been processed
    You will receive an email shortly with an activation link that should be visited within the next 24 hours to activate your account

    Thank you for registering at MichielHost Frag Team!
    Member mail: Message could not be sent.

    Mailer Error: SMTP Error: Could not connect to SMTP host. "

    Still getting the same error :confused::confused: and i have gone though it with no luck :(

    What do I need to change these settings to?

    "Allow the use of HTML in email Yes/No
    Use SMTP server as opposed to PHP's mailer Yes/No
    SMTP host address (smtp.host.tld) : ____________
    Does server require SMTP authorization Yes/No
    SMTP username: __________
    SMTP password: __________"


  • Advertisement
  • Registered Users, Registered Users 2 Posts: 1,521 ✭✭✭Joseph


    I also have a smtp.php file in it are the following:

    [PHP]<?php
    ////////////////////////////////////////////////////
    // SMTP - PHP SMTP class
    //
    // Version 1.02
    //
    // Define an SMTP class that can be used to connect
    // and communicate with any SMTP server. It implements
    // all the SMTP functions defined in RFC821 except TURN.
    //
    // Author: Chris Ryan
    //
    // License: LGPL, see LICENSE
    ////////////////////////////////////////////////////

    /**
    * SMTP is rfc 821 compliant and implements all the rfc 821 SMTP
    * commands except TURN which will always return a not implemented
    * error. SMTP also provides some utility methods for sending mail
    * to an SMTP server.
    * @package PHPMailer
    * @author Chris Ryan
    */

    # $Id: smtp.php,v 9.4 2006/01/03 02:03:38 djmaze Exp $

    class SMTP
    {
    /**
    * SMTP server port
    * @var int
    */
    var $SMTP_PORT = 25;

    /**
    * SMTP reply line ending
    * @var string
    */
    var $CRLF = "\r\n";

    /**
    * Sets whether debugging is turned on
    * @var bool
    */
    var $do_debug; # the level of debug to perform

    /**#@+
    * @access private
    */
    var $smtp_conn; # the socket to the server
    var $error; # error if any on the last call
    var $helo_rply; # the reply the server sent to us for HELO
    /**#@-*/

    /**
    * Initialize the class so that the data is in a known state.
    * @access public
    * @return void
    */
    function SMTP() {
    $this->smtp_conn = 0;
    $this->error = null;
    $this->helo_rply = null;

    $this->do_debug = 0;
    }

    /*************************************************************
    * CONNECTION FUNCTIONS *
    ***********************************************************/

    /**
    * Connect to the server specified on the port specified.
    * If the port is not specified use the default SMTP_PORT.
    * If tval is specified then a connection will try and be
    * established with the server for that number of seconds.
    * If tval is not specified the default is 30 seconds to
    * try on the connection.
    *
    * SMTP CODE SUCCESS: 220
    * SMTP CODE FAILURE: 421
    * @access public
    * @return bool
    */
    function Connect($host,$port=0,$tval=30) {
    # set the error val to null so there is no confusion
    $this->error = null;

    # make sure we are __not__ connected
    if ($this->connected()) {
    # ok we are connected! what should we do?
    # for now we will just give an error saying we
    # are already connected
    $this->error = array('error' => 'Already connected to a server');
    return false;
    }

    if (empty($port)) { $port = $this->SMTP_PORT; }

    #connect to the smtp server
    $this->smtp_conn = fsockopen($host, # the host of the server
    $port, # the port to use
    $errno, # error number if any
    $errstr, # error message if any
    $tval); # give up after ? secs
    # verify we connected properly
    if (empty($this->smtp_conn)) {
    $this->error = array('error' => 'Failed to connect to server',
    'errno' => $errno,
    'errstr' => $errstr);
    if ($this->do_debug >= 1) {
    echo "SMTP -> ERROR: ".$this->error["error"].": $errstr ($errno)".$this->CRLF;
    }
    return false;
    }

    # sometimes the SMTP server takes a little longer to respond
    # so we will give it a longer timeout for the first read
    // Windows still does not have support for this timeout function
    if (!WINDOWS) { socket_set_timeout($this->smtp_conn, $tval, 0); }

    # get any announcement stuff
    $announce = $this->get_lines();

    # set the timeout of any socket functions at 1/10 of a second
    //if (function_exists("socket_set_timeout"))
    // socket_set_timeout($this->smtp_conn, 0, 100000);

    if ($this->do_debug >= 2) {
    echo "SMTP -> FROM SERVER:".$this->CRLF.$announce;
    }

    return true;
    }

    /**
    * Performs SMTP authentication. Must be run after running the
    * Hello() method. Returns true if successfully authenticated.
    * @access public
    * @return bool
    */
    function Authenticate($username, $password) {
    // Start authentication
    fputs($this->smtp_conn,'AUTH LOGIN'.$this->CRLF);

    $rply = $this->get_lines();
    $code = substr($rply,0,3);

    if ($code != 334) {
    $this->error =
    array('error' => 'AUTH not accepted from server',
    'smtp_code' => $code,
    'smtp_msg' => substr($rply,4));
    if ($this->do_debug >= 1) {
    echo "SMTP -> ERROR: ".$this->error["error"].": ".$rply.$this->CRLF;
    }
    return false;
    }

    // Send encoded username
    fputs($this->smtp_conn, base64_encode($username).$this->CRLF);

    $rply = $this->get_lines();
    $code = substr($rply,0,3);

    if ($code != 334) {
    $this->error =
    array('error' => 'Username not accepted from server',
    'smtp_code' => $code,
    'smtp_msg' => substr($rply,4));
    if ($this->do_debug >= 1) {
    echo "SMTP -> ERROR: ".$this->error["error"].": ".$rply.$this->CRLF;
    }
    return false;
    }

    // Send encoded password
    fputs($this->smtp_conn, base64_encode($password).$this->CRLF);

    $rply = $this->get_lines();
    $code = substr($rply,0,3);

    if ($code != 235) {
    $this->error =
    array('error' => 'Password not accepted from server',
    'smtp_code' => $code,
    'smtp_msg' => substr($rply,4));
    if ($this->do_debug >= 1) {
    echo "SMTP -> ERROR: ".$this->error["error"].": ".$rply.$this->CRLF;
    }
    return false;
    }

    return true;
    }

    /**
    * Returns true if connected to a server otherwise false
    * @access private
    * @return bool
    */
    function Connected() {
    if (!empty($this->smtp_conn)) {
    $sock_status = socket_get_status($this->smtp_conn);
    if ($sock_status) {
    # hmm this is an odd situation... the socket is
    # valid but we aren't connected anymore
    if ($this->do_debug >= 1) {
    echo "SMTP -> NOTICE:".$this->CRLF."EOF caught while checking if connected";
    }
    $this->Close();
    return false;
    }
    return true; # everything looks good
    }
    return false;
    }

    /**
    * Closes the socket and cleans up the state of the class.
    * It is not considered good to use this function without
    * first trying to use QUIT.
    * @access public
    * @return void
    */
    function Close() {
    $this->error = null; # so there is no confusion
    $this->helo_rply = null;
    if (!empty($this->smtp_conn)) {
    # close the connection and cleanup
    fclose($this->smtp_conn);
    $this->smtp_conn = 0;
    }
    }

    [/PHP]

    Thanks in advance :rolleyes:
    Btw that is just 1/2 of the SMTP.php file -> but it wouldnt let me post it all :D


  • Registered Users, Registered Users 2 Posts: 3,514 ✭✭✭Rollo Tamasi




Advertisement