Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

SMTP problem - how to generate an error log

2»

Comments

  • try this script. you will need to edit it to match your case

    <?php
    
       //set absolute path of phpmailer in forum
       require('/path/to/forum/library/vendors/class.phpmailer.php'); 
    
       //set the following
       $SupportName = 'Support';
       $SupportAddress = '[email protected]';
       $SmtpHost = 'yourhost.net';
       $SmtpUser = 'your+user';
       $SmtpPassword = 'yourpass';
       $SmtpPort = 25;
       $SmtpSecurity =''; //blank or tls/ssl
    
    
       //set recipient details 
       $RecipientEmail = '[email protected]';
       $RecipientName = 'Their Name';
    
    
      // do not edit bellow
    
       $PhpMailer = new PHPMailer();
       $PhpMailer->CharSet = 'utf-8';
       $PhpMailer->SingleTo = FALSE;
       $PhpMailer->IsSMTP();
    
       $PhpMailer->Host = $SmtpHost;
       $PhpMailer->Port = $SmtpPort;
       $PhpMailer->SMTPSecure = $SmtpSecurity;
       $PhpMailer->Username = $SmtpUser;
       $PhpMailer->Password = $SmtpPassword;
    
       $PhpMailer->SetFrom($SupportAddress, $SupportName, FALSE);
       $PhpMailer->AddAddress($RecipientEmail, $RecipientName);
    
       $PhpMailer->Subject = 'test message';
       $PhpMailer->Body = 'test message';
    
       $PhpMailer->ThrowExceptions(TRUE);
       if (!$PhpMailer->Send()) {
          throw new Exception($PhpMailer->ErrorInfo);
       }
    
    
    

    grep is your friend.

    UnderDoghgtonight
  • I've tested fsockopen and it is enabled.

    I have just run x00's script and both received the email fine and got a page of information, of which the most salient parts are:

    SMTP -> get_lines(): $data was ""
    SMTP -> get_lines(): $str is "250 2.1.0 Sender OK "
    SMTP -> get_lines(): $data is "250 2.1.0 Sender OK "
    SMTP -> FROM SERVER:250 2.1.0 Sender OK
    SMTP -> get_lines(): $data was ""
    SMTP -> get_lines(): $str is "250 2.1.5 Recipient OK "

    So, by my reckoning, there is no issue with phpmailer's ability to send an email via our smtp host to our mailboxes.

    So any clues as to why creating new users comes back with the error and no emails being sent?

  • peregrineperegrine MVP
    edited January 2014

    what values are in $rt and what values are in the parameters in the lines with @mail ? when you debugged.

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • Sorry, I wasn't sure what your last post meant so I haven't applied any of that. Not sure where to make the changes or quite how e.g. add a var dump

    Thanks for the continued support (and patience!)

  • x00x00 MVP
    edited January 2014

    can you post you conf/config.php file (obviously wit the sensitive parts removed)?

    grep is your friend.

  • peregrineperegrine MVP
    edited January 2014

    look in library/vendors/phpmailer/

    make a copy of
    class.phpmailer.php and store it somewhere on a local pc for safekeeping.

    when you got the instantiate errors the error came from throw...

    so modify class.phpmailer.php

    throw new phpmailerException($this->Lang('instantiate'), self::STOP_CRITICAL);

    change to by cutting and pasting this.

    throw new phpmailerException(" val:" . $val . " to:" . $to . " subject:" . $this->Subject . " body:" . $body . " header:" . $header, self::STOP_CRITICAL);

    this should tell you what parameters are used when attempting to mail.

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • @peregrine said:
    look in library/vendors/phpmailer/

    make a copy of
    class.phpmailer.php and store it somewhere on a local pc for safekeeping.

    then modify class.phpmailer.php

    throw new phpmailerException($this->Lang('instantiate'), self::STOP_CRITICAL);

    change to

    throw new phpmailerException(" val:" . $val . " to:" . $to . " subject:" . $this->Subject . " body:" . $body . " header:" . $header, self::STOP_CRITICAL);

    this should tell you what parameters are used when attempting to mail.

    hold on that for a second.

    grep is your friend.

  • hold on that for a second.

    I think he took your advice x00 :).

    a long second.....

    must be a lunch break, nap time or dinner :)
    on a roll, and then no report back to command control.

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

    vrijvlinder
  • edited January 2014

    Time works differently over here... :)

    desensitised config.php:

    <?php if (!defined('APPLICATION')) exit();
    
    // Conversations
    $Configuration['Conversations']['Version'] = '2.0.18.10';
    
    // Database
    $Configuration['Database']['Name'] = 'Forum';
    $Configuration['Database']['Host'] = 'localhost';
    $Configuration['Database']['User'] = 'xxxx';
    $Configuration['Database']['Password'] = 'xxxx';
    
    // EnabledApplications
    $Configuration['EnabledApplications']['Conversations'] = 'conversations';
    $Configuration['EnabledApplications']['Vanilla'] = 'vanilla';
    
    // EnabledPlugins
    $Configuration['EnabledPlugins']['GettingStarted'] = 'GettingStarted';
    $Configuration['EnabledPlugins']['HtmLawed'] = 'HtmLawed';
    $Configuration['EnabledPlugins']['cleditor'] = TRUE;
    $Configuration['EnabledPlugins']['VanillaStats'] = TRUE;
    $Configuration['EnabledPlugins']['Tagging'] = TRUE;
    $Configuration['EnabledPlugins']['SplitMerge'] = TRUE;
    $Configuration['EnabledPlugins']['Emotify'] = TRUE;
    $Configuration['EnabledPlugins']['AllViewed'] = TRUE;
    $Configuration['EnabledPlugins']['embedvanilla'] = TRUE;
    
    // Garden
    $Configuration['Garden']['Title'] = 'Generic Name Forum';
    $Configuration['Garden']['Cookie']['Domain'] = '';
    $Configuration['Garden']['Registration']['ConfirmEmail'] = '1';
    $Configuration['Garden']['Registration']['Method'] = 'Approval';
    $Configuration['Garden']['Registration']['ConfirmEmailRole'] = '3';
    $Configuration['Garden']['Registration']['CaptchaPrivateKey'] = '';
    $Configuration['Garden']['Registration']['CaptchaPublicKey'] = '';
    $Configuration['Garden']['Registration']['InviteExpiration'] = '-1 week';
    $Configuration['Garden']['Registration']['InviteRoles'] = 'a:5:{i:3;s:1:"0";i:4;s:1:"0";i:8;s:1:"0";i:16;s:1:"0";i:32;s:1:"0";}';
    $Configuration['Garden']['Email']['SupportName'] = 'Generic Name';
    $Configuration['Garden']['Email']['SupportAddress'] = '[email protected]';
    $Configuration['Garden']['Email']['UseSmtp'] = '1';
    $Configuration['Garden']['Email']['SmtpHost'] = 'SMTPHost.com';
    $Configuration['Garden']['Email']['SmtpUser'] = '[email protected]';
    $Configuration['Garden']['Email']['SmtpPassword'] = 'xxxx';
    $Configuration['Garden']['Email']['SmtpPort'] = '25';
    $Configuration['Garden']['Email']['SmtpSecurity'] = '';
    $Configuration['Garden']['Version'] = '2.0.18.8';
    $Configuration['Garden']['RewriteUrls'] = FALSE;
    $Configuration['Garden']['CanProcessImages'] = TRUE;
    $Configuration['Garden']['Installed'] = TRUE;
    $Configuration['Garden']['Analytics']['AllowLocal'] = TRUE;
    $Configuration['Garden']['Errors']['MasterView'] = 'deverror.master.php';
    $Configuration['Garden']['Format']['Hashtags'] = FALSE;
    
    // Plugins
    $Configuration['Plugins']['GettingStarted']['Dashboard'] = '1';
    $Configuration['Plugins']['GettingStarted']['Plugins'] = '1';
    $Configuration['Plugins']['GettingStarted']['Registration'] = '1';
    $Configuration['Plugins']['GettingStarted']['Categories'] = '1';
    
    // Routes
    $Configuration['Routes']['DefaultController'] = 'a:2:{i:0;s:14:"categories/all";i:1;s:8:"Internal";}';
    
    // Vanilla
    $Configuration['Vanilla']['Version'] = '2.0.18.10';
    $Configuration['Vanilla']['AdminCheckboxes']['Use'] = TRUE;
    
    // Last edited by Admin (::1)2014-01-15 15:52:03
    
  • Sorry, it's gone a bit wonky in the flesh for some reason, but the information is there


  • grep is your friend.

  • x00x00 MVP
    edited January 2014

    I presume you have the exact same details here than you used in the test.

    $Configuration['Garden']['Email']['SupportName'] = 'Generic Name';
    $Configuration['Garden']['Email']['SupportAddress'] = '[email protected]';
    $Configuration['Garden']['Email']['UseSmtp'] = '1';
    $Configuration['Garden']['Email']['SmtpHost'] = 'SMTPHost.com';
    $Configuration['Garden']['Email']['SmtpUser'] = '[email protected]';
    $Configuration['Garden']['Email']['SmtpPassword'] = 'xxxx';
    $Configuration['Garden']['Email']['SmtpPort'] = '25';
    $Configuration['Garden']['Email']['SmtpSecurity'] = '';
    

    you could tail the smtp log file

    maybe try https://github.com/tualatin/tailforwindows or cygwin

    You should be able to confirm, by triggering mail through forum posts.

    grep is your friend.

  • wht smtp server are you using windows own or some other? Either way you will need to tap their logging.

    grep is your friend.

  • @x00 said:
    I presume you have the exact same details here than you used in the test.

    ~~~
    $Configuration['Garden']['Email']['SupportName'] = 'Generic Name';
    $Configuration['Garden']['Email']['SupportAddress'] = '[email protected]';
    $Configuration['Garden']['Email']['UseSmtp'] = '1';
    $Configuration['Garden']['Email']['SmtpHost'] = 'SMTPHost.com';
    $Configuration['Garden']['Email']['SmtpUser'] = '[email protected]';
    $Configuration['Garden']['Email']['SmtpPassword'] = 'xxxx';
    $Configuration['Garden']['Email']['SmtpPort'] = '25';
    $Configuration['Garden']['Email']['SmtpSecurity'] = '';

    Yes, these are the same details.

    I'm about to get bogged down in other work duties, so I'll try your other suggestions later, thanks.

  • windows isn't officially supported but if should work. First you have to find if there is any out going mail traffic, which a task specific to your setup. That way you can rule out problems with vanilla.

    The only other issues I can think for is preferences are not set up correctly for the the user, or either that or the activity table being corrupted or in need or repair.

    grep is your friend.

  • Yes, it is Windows. The extremely odd thing is that I have just discovered in my Junk folder some emails from Vanilla. I checked with my other test users and they also had something in their Junk. Looking at the date stamp on them, they were generated during a period of testing where changes were being made. However, as Vanilla still kept returning the error messages, I was unaware that anything had gone out.

    So, it would seem that at some point, something I changed enabled mail to get through but was junked by the Exchange server. Unfortunately, I cannot replicate it now :#

    I'm still unclear as to why, if it had successfully sent a message (albeit getting junked), I still got the 'could not instantiate/could not connect' error?

  • x00x00 MVP
    edited January 2014

    you mail server mail have outgoing filters like spam assassin and clam.

    You can try looking at the the mail header to see if there are any clues.

    Also try an replicate the support name and email.

    grep is your friend.

Sign In or Register to comment.