Not sure if this is the correct section for this, but it didn't seem to fit elsewhere.

So here's the deal.

At work we recently rebuilt our internal server. It was long overdue and now it runs much better... for the most part. Apache, MySQL, PHP, etc. all run like they used to, and now we're running with the latest versions of whatever is packaged with XAMPP. The only problem is we cannot get the emails to work. I wasn't involved during the set up of the email portion before, but as time went on I slowly became the de facto "server admin" simply because I knew more than the others about configuring Apache, MySQL, PHP (I've set them up manually while others do it via XAMPP), user management, mapping drives, setting permissions, etc. So I essentially inherited the server. Also over this time period the main person who configured Mercury is no longer with the company... and never documented anything. One other person was kind of involved, but doesn't remember enough to be useful. He said he just found a video online that worked with Thunderbird and that was it.

Him and I sat down and tried to get it configured, but have had no luck. He thinks he found the video that he used before, and we followed the steps, but no matter what we have tried emails just do not send. We have googled quite a bit and read a lot of walkthroughs and watched a lot of videos, but all the same result.

The way it worked before is you would use the mail() function and then the recipient address would receive an email from our foo@ourcompanyname.com email account. I wish I knew what the previous settings were in Thunderbird or Mercury, but like I said, unfortunately I was not involved (otherwise I would have written this stuff down).

Just to be clear there is no error from the mail() function of any kind. When I execute a call to mail() it returns true, so PHP itself is happy with whatever configuration there is, but since we all know just because the mail() function is happy, doesn't mean the email will actually be sent/received.

I would have thought there would be an easy way to enter credentials for an email address including SMTP information, and Mercury just sends the email on its behalf. We have all the info for our email address plus the smtp.gmail.com SMTP info, so I would have thought this process would be simple, but I guess not.

I've tried working with MercuryC SMTP and MercuryE SMTP (amongst others) to no avail.

Does anyone have any experience with this, or a link to a walkthrough?

Thanks for reading.

    I probably don't know enough about the subject to know if this would be a viable solution, but PHPMailer comes with its own SMTP class (all native PHP) that you might be able to leverage if all else fails?

      Quick addendum:

      I am able to send email from our server via Thunderbird through our foo@ourcompanyname.com email account. I just need to tell PHP/Mercury that when the mail() function is executed, to tell Mercury to send the email via that account.

      NogDog;11038329 wrote:

      I probably don't know enough about the subject to know if this would be a viable solution, but PHPMailer comes with its own SMTP class (all native PHP) that you might be able to leverage if all else fails?

      We'll be exploring all options if we cannot get this to work.

        I apologize if this incorrect but wouldn't you just need to change your PHP.ini?

        [mail function]
        SMTP=your_mercury_ip (ie:smtp ip)
        smtp_port=25
        sendmail_from = me@example.com
        
          jeepin81;11038335 wrote:

          I apologize if this incorrect but wouldn't you just need to change your PHP.ini?

          [mail function]
          SMTP=your_mercury_ip (ie:smtp ip)
          smtp_port=25
          sendmail_from = me@example.com
          

          I've been pulled off it for now since I have some deadlines I have to meet, so I haven't had a chance to test this, but during my troubleshooting I did change the values of those items (I've since commented them out).

          This is what I currently have, which is pretty similar to what you suggested (though note the comment above the SMTP port):

          [mail function]
          ; XAMPP: Comment out this if you want to work with an SMTP Server like Mercury
          ;SMTP = 192.168.1.150
          ;smtp_port = 25
          
          ; For Win32 only.
          ; http://php.net/sendmail-from
          ;sendmail_from = postmaster@localhost
          

          I guess I should change the 192.168.1.150 to 127.0.0.1 or localhost?

            Bonesnap;11038341 wrote:

            I guess I should change the 192.168.1.150 to 127.0.0.1 or localhost?

            Is there a server of the correct type answering the correct port at one of those addresses?

            Not sure if you can do this from CLI in Windows, but in 'Nix it'd be something like (for SMTP):

            telnet localhost 25
            Trying 127.0.0.1...
            Connected to localhost.
            Escape character is '^]'.
            220 freebsd-devel.ombe.com ESMTP Sendmail 8.14.5/8.14.4; Thu, 13 Feb 2014 11:12:21 -0600 (CST)

            Which tells me, at the very least, that the Sendmail SMTP server is indeed listening on "localhost", port 25.

            If you have Win7+, I think you can also do this from the CLI (I seem to be able to from Win7).

              Bonesnap;11038341 wrote:
              [mail function]
              ; XAMPP: Comment out this if you want to work with an SMTP Server like Mercury
              ;SMTP = 192.168.1.150
              ;smtp_port = 25
              
              ; For Win32 only.
              ; http://php.net/sendmail-from
              ;sendmail_from = postmaster@localhost
              

              Er... is that exactly what you have? Because if you'll note the semicolons out front, that is equivalent to having:

              [mail function]
                bradgrafelman;11038353 wrote:

                Er... is that exactly what you have? Because if you'll note the semicolons out front, that is equivalent to having:

                [mail function]

                I don't think so ...

                Bonesnap;11038341 wrote:

                (I've since commented them out).

                  dalecosp;11038349 wrote:

                  Is there a server of the correct type answering the correct port at one of those addresses?

                  Not sure if you can do this from CLI in Windows, but in 'Nix it'd be something like (for SMTP):

                  telnet localhost 25
                  Trying 127.0.0.1...
                  Connected to localhost.
                  Escape character is '^]'.
                  220 freebsd-devel.ombe.com ESMTP Sendmail 8.14.5/8.14.4; Thu, 13 Feb 2014 11:12:21 -0600 (CST)

                  Which tells me, at the very least, that the Sendmail SMTP server is indeed listening on "localhost", port 25.

                  If you have Win7+, I think you can also do this from the CLI (I seem to be able to from Win7).

                  Define correct type. Everything is on localhost, but I decided to try the 192.168.x address because I was getting desperate. I don't think practically it would make any difference, but who knows.

                  And we are running Windows 7 Ultimate but the telnet command is not recognized. Is there any other way I can check on Windows if that's running correctly (like check a specific service or something)?

                  bradgrafelman;11038353 wrote:

                  Er... is that exactly what you have? Because if you'll note the semicolons out front, that is equivalent to having:

                  [mail function]

                  Heh yeah I had them uncommented when I was testing it out, but since then I have them commented out. According to the php.ini file they're supposed to be shrug. Regardless of what I have done with those properties I have not had any difference in behaviour.

                  Also, does anyone know what (if any) difference there is between Mercury and Sendmail? I've seen both come up when I've been googling, but don't know enough to differentiate them or if they're the same thing but people interchange terminology. Sometimes it seems it's part of Mercury but I haven't read anything that says that explicitly.

                    Dang. Lost a huge post here. To summarize:

                    SMTP = Simple Mail Transport Protocol. Port 25/465(secure). Common MTA (Mail Transport Agent) servers include Sendmail, Postfix, Exim, Exchange, and a host of others.

                    POP3 = Post Office Protocol v3. Port 110/995(secure). Common POP servers include Qpopper, Dovecot, Courier, Cyrus, Exchange, and many more.

                    IMAP = Internet Message Access Protocol. Port 143/993(secure). Many POP servers also do IMAP.

                    Client programs are, technically, called MUA's (Mail User-Agents). Common MUA's include tons of web apps (Gmail, anyone?), Outlook, Windows Mail, Eudora, LotusNotes, mutt, elm, pine, /bin/mail ... 😛 Well, at any rate, there's about a thousand ways to read email.

                    The chief difference between IMAP and POP is that in IMAP messages remain on the server by default. An IMAP client must always have access to the network in order to operate, whereas a POP3 system can connect, download the messages, and disconnect.

                    As near as I can tell, Mercury is David Harris' SMTP implementation, designed to work closely with his MUA Pegasus. I don't know how much of his work might be based on Sendmail. Both Mercury and Sendmail would speak (E)SMTP, but they are not the same software.

                    HTH,

                      Incidentally, if you'd like to PM me the FQDN of your mail server, I could see if it's available from the central USA.

                        3 months later

                        Sorry for bumping this topic but this issue has come up again and I have now been allocated some time today to get the mail server working once again.

                        I have been fiddling around with it and I am a little further along than I was back in February when I first tackled this. I am now able to send mail successfully through Mercury via our company GMail account using the relay client (MercuryC), so that is all set up and good. The issue I am having is the mail() function in PHP is not communicating with Mercury for some reason, so no emails are being sent from our scripts (the function always returns true but we all know that means nothing). I can't seem to find any clear instructions on exactly what to change in the php.ini file. Most articles I have read seem to write this:

                        [mail function]
                        ; XAMPP: Comment out this if you want to work with an SMTP Server like Mercury
                        SMTP = localhost
                        smtp_port = 25
                        
                        ; For Win32 only.
                        ; http://php.net/sendmail-from
                        sendmail_from = postmaster@localhost
                        

                        But I have also tried other variations with no change in behaviour, including replacing "localhost" with "smtp.gmail.com" and replacing "25" with "587" (port 465 causes Mercury to have connection issues with Google. shrug). In any case, regardless of what I seem to put in for these values nothing is being "picked up" by Mercury. I am watching the core processes and the MercuryC windows in Mercury and don't see any activity when I execute the mail() function. So I guess my question is does anyone know what values I should be putting in the php.ini file, and should I be commenting the lines or not? The wording that's there is really annoying because I'm not completely sure what it means. I am of course referring to:

                        ;XAMPP: Comment out this if you want to work with an SMTP Server like Mercury

                        Any help or insight would be greatly appreciated. Thanks guys!

                          How did you verify Mercury was able to send e-mail via GMail? What client were you using to send those test e-mails?

                          Seems like you just need to mimic that client's settings in PHP, perhaps?

                          EDIT: Also, is Mercury's logging functionality enabled? Have you tried combing through those logs to see if there is any indication that your PHP-based e-mails are at least reaching Mercury but perhaps some other error is occurring?

                            bradgrafelman;11041277 wrote:

                            How did you verify Mercury was able to send e-mail via GMail? What client were you using to send those test e-mails?

                            In Mercury itself I went to File > Send mail message and then put in an address, subject, etc. and sent it. Saw Mercury do its thing, and then received it in the inbox of the target email. I also checked the sent box of our GMail account and it was there.

                            bradgrafelman;11041277 wrote:

                            Seems like you just need to mimic that client's settings in PHP, perhaps?

                            You would think so, and I have tried that but to no avail. Mercury just doesn't seem to acknowledge the mail() function.

                            Quick addendum: I am able to send emails via Mercury and the end-to-end module (MercuryE) as well, but those are not sent through our GMail account.

                            EDIT:

                            bradgrafelman;11041277 wrote:

                            Also, is Mercury's logging functionality enabled? Have you tried combing through those logs to see if there is any indication that your PHP-based e-mails are at least reaching Mercury but perhaps some other error is occurring?

                            The logs were not turned on, but I enabled them and ran some test runs and they don't update at all, so there's nothing in there relating to PHP. The logs only update if I send an email within Mercury itself. I tried this with both MercuryC and MercuryE, and with the SMTP values commented and uncommented in the php.ini file. The result was the same across the board.

                              Okay I now have emails sending via PHP scripts; however, I'm no longer using Mercury. This happened by accident and to be perfectly honest I am not quite sure how I got there (I did a lot of commenting, uncommenting, changing values, running simple mail scripts, etc. - basically a lot of trial and error), but this is what I did.

                              First, in the php.ini file these lines are commented:

                              [mail function]
                              ; XAMPP: Comment out this if you want to work with an SMTP Server like Mercury
                              ;SMTP = localhost
                              ;smtp_port = 25
                              
                              ; For Win32 only.
                              ; http://php.net/sendmail-from
                              ;sendmail_from = postmaster@localhost
                              

                              Next, I reversed the commenting of these two rules/properties/attributes/whatever:

                              ; XAMPP IMPORTANT NOTE (1): If XAMPP is installed in a base directory with spaces (e.g. c:\program filesC:\xampp) fakemail and mailtodisk do not work correctly.
                              ; XAMPP IMPORTANT NOTE (2): In this case please copy the sendmail or mailtodisk folder in your root folder (e.g. C:\sendmail) and use this for sendmail_path.  
                              ; XAMPP: Comment out this if you want to work with fakemail for forwarding to your mailbox (sendmail.exe in the sendmail folder) sendmail_path = "\"C:\xampp\sendmail\sendmail.exe\" -t" ; XAMPP: Comment out this if you want to work with mailToDisk, It writes all mails in the C:\xampp\mailoutput folder ;sendmail_path="C:\xampp\mailtodisk\mailtodisk.exe"

                              The mailtodisk line was uncommented and the other one was commented by default. I don't know if it's supposed to be like that, but I reversed it to what you see above. I then edited the sendmail.ini file and put in the SMTP info for GMail and our email account and voila. I don't know why Mercury couldn't understand/listen for the mail() function, but sendmail seemed to have no problem. Emails send, they're received, and they appear in the outbox of our email account. shrug I turned off Mercury and ran a few tests and emails are sent just fine. It feels like it takes an extra second or two, so I don't think I have it set up the same way as in the past (I'm 99% sure the previous set up was done through Mercury), but the emails are working and my boss (plus myself) is very happy.

                              Are there any special caveats/gotchyas/etc. with sendmail?

                              Thanks everyone for your time!

                              I still think the wording/descriptions for some of these things could be changed to clearer language. I think it's perfectly reasonable for someone to misunderstand what "commenting out" means.

                                Are there any special caveats/gotchyas/etc. with sendmail?

                                Configuration is a PITA, but it's solid (at least on 'Nix) and shouldn't need too much tweaking....

                                  Write a Reply...