We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 28042 ☆ A M B ☆
    • 24,524 Posts
    They have it locked down so you have to use a specific "from" address; the same one you use to log in to the mail account with. You still only need to edit the files as I’ve mentioned in my previous posts. You can still use the eForm parameters for &from, &fromname, &replyto and &to; it will set the relevant values for the mailer class. Just make sure that &from=`[email protected]` is the same email address that you use to log to your mail account with.
      Studying MODX in the desert - http://sottwell.com
      Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
      Join the Slack Community - http://modx.org
      • 23299
      • 1,161 Posts
      Wow this frustrating.

      I keep getting the same error: CCSender: Mailer was unable to send mailSMTP Error: The following recipients failed: [email protected]

      The lines I am editing are different and I am not sure if they all need the same edit.

      Line 350 that looks like this:
      	$mail = new PHPMailer();
      					$mail->IsMail();
      					$mail->IsHTML($isHtml);
      					$mail->From		= $modx->config['emailsender'];
      					$mail->FromName	= $modx->config['site_name'];
      					$mail->Subject	= $_lang['ef_mail_abuse_subject'];
      					$mail->Body		= $body;
      					AddAddressToMailer($mail,"to",$modx->config['emailsender']);
      					$mail->send(); //ignore mail errors in this case

      Is edited like so:
      $mail = new PHPMailer();
      					$mail->IsSMTP();
      					$mail->Host = 'mail.sitename.com';
      					$mail->SMTPAuth = true;
      					$mail->Username = 'name';
      					$mail->Password = 'password';
      					$mail->IsHTML($isHtml);
      					$mail->From		= $modx->config['[email protected]'];
      					$mail->FromName	= $modx->config['site_name'];
      					$mail->Subject	= $_lang['ef_mail_abuse_subject'];
      					$mail->Body		= $body;
      					AddAddressToMailer($mail,"to",$modx->config['emailsender']);
      					$mail->send(); //ignore mail errors in this case


      Line 442 that looked liked this:
      $mail = new PHPMailer();
      					$mail->IsMail();
      					$mail->CharSet = $modx->config['modx_charset'];
      					$mail->IsHTML($isHtml);
      					$mail->From		= $from;
      					$mail->FromName	= $fromname;
      					$mail->Subject	= $subject;
      					$mail->Body		= $report;
      					AddAddressToMailer($mail,"replyto",$replyto);
      					AddAddressToMailer($mail,"to",$to);
      					AddAddressToMailer($mail,"cc",$cc);
      					AddAddressToMailer($mail,"bcc",$bcc);
      					AttachFilesToMailer($mail,$attachments);
      					if(!$mail->send()) return 'Main mail: ' . $_lang['ef_mail_error'] . $mail->ErrorInfo;


      Now is edited like so:
        $mail = new PHPMailer();
      						$mail->IsSMTP();
      						$mail->Host = 'mail.sitename.com';
      						$mail->SMTPAuth = true;
      						$mail->Username = 'name';
      						$mail->Password = 'password';
      					$mail->CharSet = $modx->config['modx_charset'];
      					$mail->IsHTML($isHtml);
      					$mail->From		= $from;
      					$mail->FromName	= $fromname;
      					$mail->Subject	= $subject;
      					$mail->Body		= $report;
      					AddAddressToMailer($mail,"replyto",$replyto);
      					AddAddressToMailer($mail,"to",$to);
      					AddAddressToMailer($mail,"cc",$cc);
      					AddAddressToMailer($mail,"bcc",$bcc);
      					AttachFilesToMailer($mail,$attachments);
      					if(!$mail->send()) return 'Main mail: ' . $_lang['ef_mail_error'] . $mail->ErrorInfo;


      Line 460 that looked like this:
      $mail = new PHPMailer();
      					$mail->IsMail();
      					$mail->CharSet = $modx->config['modx_charset'];
      					$mail->IsHTML($isHtml);
      					$mail->From		= $from;
      					$mail->FromName	= $fromname;
      					$mail->Subject	= $subject;
      					$mail->Body		= $report;
      					AddAddressToMailer($mail,"to",$fields['email']);
      					AttachFilesToMailer($mail,$attachments);
      					if(!$mail->send()) return 'CCSender: ' . $_lang['ef_mail_error'] . $mail->ErrorInfo;


      Now is edited like this:
      	$mail = new PHPMailer();
      						$mail->IsSMTP();
      						$mail->Host = 'mail.sitename.com';
      						$mail->SMTPAuth = true;
      						$mail->Username = 'cnames';
      						$mail->Password = 'password';
      					$mail->CharSet = $modx->config['modx_charset'];
      					$mail->IsHTML($isHtml);
      					$mail->From		= '[email protected]';
      					$mail->FromName	= $fromname;
      					$mail->Subject	= $subject;
      					$mail->Body		= $report;
      					AddAddressToMailer($mail,"to",$fields['email']);
      					AttachFilesToMailer($mail,$attachments);
      					if(!$mail->send()) return 'CCSender: ' . $_lang['ef_mail_error'] . $mail->ErrorInfo;


      Line 478 that looked like this:
      $mail = new PHPMailer();
      					$mail->IsMail();
      					$mail->CharSet = $modx->config['modx_charset'];
      					$mail->IsHTML($isHtml);
      					$mail->From		= ($autosender)? $autosender:$from;
      					$mail->FromName	= ($autoSenderName)?$autoSenderName:$fromname;
      					$mail->Subject	= $subject;
      					$mail->Body		= $autotext;
      					AddAddressToMailer($mail,"to",$fields['email']);
      					if(!$mail->send()) return 'AutoText: ' . $_lang['ef_mail_error'] . $mail->ErrorInfo;


      Is now edited like this: $mail = new PHPMailer();
      $mail->IsSMTP();
      $mail->Host = ’mail.sitename.com’;
      $mail->SMTPAuth = true;
      $mail->Username = ’name’;
      $mail->Password = ’password’;
      $mail->CharSet = $modx->config[’modx_charset’];
      $mail->IsHTML($isHtml);
      $mail->From = ($autosender)? $autosender:$from;
      $mail->FromName = ($autoSenderName)?$autoSenderName:$fromname;
      $mail->Subject = $subject;
      $mail->Body = $autotext;
      AddAddressToMailer($mail,"to",$fields[’email’]);
      if(!$mail->send()) return ’AutoText: ’ . $_lang[’ef_mail_error’] . $mail->ErrorInfo;

      Line 495 that looked like this:
      $mail = new PHPMailer();
      					$mail->IsMail();
      					$mail->CharSet = $modx->config['modx_charset'];
      					$mail->IsHTML($isHtml);
      					$mail->From		= $from;
      					$mail->FromName	= $fromname;
      					$mail->Subject	= $subject;
      					$mail->Body		= $mobiletext;
      					AddAddressToMailer($mail,"to",$mobile);
      					$mail->send();


      Is now edited like this:
      $mail->IsSMTP();
      						$mail->Host = 'mail.sitename.com';
      						$mail->SMTPAuth = true;
      						$mail->Username = 'name';
      						$mail->Password = 'password';
      					$mail->CharSet = $modx->config['modx_charset'];
      					$mail->IsHTML($isHtml);
      					$mail->From		= '[email protected]';
      					$mail->FromName	= $fromname;
      					$mail->Subject	= $subject;
      					$mail->Body		= $mobiletext;
      					AddAddressToMailer($mail,"to",$mobile);
      					$mail->send();


      So, there is variation in how the From code is put together.

      Am I close?

      AFAIK, the host convention here is Host=’mail.sitename.com’ and the From=’[email protected]’ huh

      It looks like the script and the snippet call is working, the messages are being received. The only glitch is the "CCSender: Mailer was unable to send mailSMTP Error: The following recipients failed: [email protected]" error message...

      In this case the address that is referred to as the "recipients failed" is the address that the sender uses in the front end of the form? Why?

      Sorry, going around the bend. This stupid thing has eaten up two days already...
        • 23299
        • 1,161 Posts
        OK,

        Seems like the username has to be the email address of the account owner. This is where I am at at line 350:
        $mail = new PHPMailer();
        					$mail->IsSMTP();
        					$mail->Host = 'mail.sitename.com';
        					$mail->SMTPAuth = true;
        					$mail->Username = '[email protected]';
        					$mail->Password = 'password';
        					$mail->IsHTML($isHtml);
        					$mail->From		= '[email protected]';
        					$mail->FromName	= $modx->config['site_name'];
        					$mail->Subject	= $_lang['ef_mail_abuse_subject'];
        					$mail->Body		= $body;
        					AddAddressToMailer($mail,"to",$modx->config['emailsender']);
        					$mail->send(); //ignore mail errors in this case


        This host requires that the Username and the From fields be the same. The form works and the messages are getting delivered.

        But when a user runs the form this message appears:
        CCSender: Mailer was unable to send mailSMTP Error: The following recipients failed: [email protected]

        I think this part of the eForm PHP code is triggering this error message somehow?:
        AddAddressToMailer($mail,"to",$modx->config['emailsender']);
        					$mail->send(); //ignore mail errors in this case


        Does this sound right?

        Thanks!


        Or is the CC function at the end of the code around line 460 (was line 442 in the default form):
        	$mail = new PHPMailer();
        					$mail->IsSMTP();
        					$mail->Host = 'mail.sitename.com';
        					$mail->SMTPAuth = true;
        					$mail->Username = 'john@sitename';
        					$mail->Password = 'password';
        					$mail->CharSet = $modx->config['modx_charset'];
        					$mail->IsHTML($isHtml);
        					$mail->From		= 'john@sitename';
        					$mail->FromName	= $fromname;
        					$mail->Subject	= $subject;
        					$mail->Body		= $report;
        					AddAddressToMailer($mail,"to",$fields['email']);
        					AttachFilesToMailer($mail,$attachments);
        					if(!$mail->send()) return 'CCSender: ' . $_lang['ef_mail_error'] . $mail->ErrorInfo;
          • 23299
          • 1,161 Posts
          Anyone have any suggestions on my last post?

          I really need to solve this!

          Thanks!
            • 28042 ☆ A M B ☆
            • 24,524 Posts
            There are 5 places in the eForm php file where this needs to be done.

            You can leave out the from and fromname, and set those from the snippet parameters as usual. Just make sure the &from parameter is set to the same email address that you use for the login.

            I hope those are not your real login and password to your smtp server; those should never be exposed to public view, as spammers will be quick to use them to use your smtp server for their spam.
              Studying MODX in the desert - http://sottwell.com
              Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
              Join the Slack Community - http://modx.org
              • 23299
              • 1,161 Posts
              So far the only person who does not get the error warning when sending the form is the site owner.

              And yes the login stuff is made up in the code I present here...
                • 23299
                • 1,161 Posts
                Quote from: sottwell at Dec 02, 2009, 01:39 PM

                There are 5 places in the eForm php file where this needs to be done.

                You can leave out the from and fromname, and set those from the snippet parameters as usual. Just make sure the &from parameter is set to the same email address that you use for the login.



                I am not what you mean about the &from parameter? I see all the $mail->From=$from; instances. I have tried leaving those the way the default form is and substituting the owner’s email address. There are five of these...

                Edit: do you mean the snippet call on the actual contact page? If so then yes these addresses match.

                No matter what I have tried I still get this when sending the form:

                CCSender: Mailer was unable to send mailSMTP Error: The following recipients failed: [email protected]


                From now on I am not going to do any MODx sites that are hosted by hosts that make you have to jump through flames just to get the MODx functions to work. I have seen what this host needs to make their required SMTP authorization work and it does not match the code in eForm. This has been a frustrating nightmare; all my other sites eForms work just fine without all this code messing around... huh
                  • 23299
                  • 1,161 Posts
                  The default eForm has five areas where the PHPmaler code resides. I have changed all the cases of $mail->IsMail(); to IsSMTP();

                  The five instances of the From code lines are different.

                  Starting from the top the default lines look like this:

                  $mail->From = $modx->config[’emailsender’];

                  $mail->From = $from;

                  $mail->From = $from;

                  $mail->From = ($autosender)? $autosender:$from;

                  $mail->From = $from;


                  I have tried several combinations of changing this: adding the site owner’s email link to all of them and to just the ones that end in =$from.

                  But I am not sure if the From fields are even the issue here? The form works, the messages get delivered but this stupid CCSender error message keeps popping up? I am sure the site owner must be wondering why we bothered changing a working static site to this error generating confusion? Sorry, I need to go work out before my head or heart explodes... >:(
                    • 37550 ☆ A M B ☆
                    • 711 Posts
                    When you are testing the form are the recipient (to) address domains hosted on the same server? If so a lot of mail software now does a local lookup for example.

                    If I created a contact form which sent a copy of the eForm to [email protected] the form would error with an unable to send message because the mail server has checked locally and found that the address does not exist.

                    If the to address is an external address like [email protected] the form should submit as the mail server will not know straight away if that address exists and will keep trying by itself.

                    What you could do for the testing of the script to make sure it is working, instead of asking the client is to set the eForm like:

                    [!eForm? &formid=`ContactForm` &from=`[+email+]` &subject=`[+subject+]` &to=`[email protected]` &ccsender=`1` &tpl=`ContactForm` &report=`ContactFormReport` &vericode=`1` &invalidClass=`invalidValue` &thankyou=`ContactFormThanks` &requiredClass=`requiredValue` &cssStyle=`ContactStyles`!]

                    Basically set your own personal email address in the &to= field like above.

                    There is also a very good snippet called eForm2DB which would enable you to log all the contact forms to database before sending that way if you ever run into mail server problems you would have a log in the database.

                    Hope that helps and good luck with the host.

                    Aaron

                      http://www.onesmarthost.co.uk
                      UK MODX Hosting with love.
                      • 23299
                      • 1,161 Posts
                      The form call looks like this:
                      [!eForm? &formid=`ContactForm` &subject=`[+subject+]` &to=`[email protected]` &ccsender=`1` &tpl=`ContactForm`&thankyou=`ThankYou` &report=`ContactFormReport` &vericode=`1` !]


                      I tried adding the call you suggest with my address in the &to field. I still get the error and I did not receive the message. Part of the SMTP authorization is that the username email address needs to be added to the eForm PHP script.

                      I think all of that is working. Its the CCSender error that has me stumped...