Testing mail from php in OS X 10.10 - php

Ever since OS X 10.8 I've used the steps here to test sending mail with php.
Basically it redirects php's sendmail_path to a .php script that saves the email message as a .emlx file and then opens Apple Mail (and that file) automatically.
This worked well until I upgraded to 10.10
After the upgrade to 10.10 all seems to work, the .emlx file is created as expected right where it is supposed to be but Apple Mail does not open up.
I'm getting the following error in my apache error_log
LSOpenURLsWithRole() failed with error -10810 for the file /Users/jason/smtp_out/2014-10-22_10.12.20_587.emlx.
I've got no clue about what LSOpenURLsWithRole() is all about. I'm guessing this is something around php not being able to open the .emlx file up in Apple Mail automatically (I can dbl click it and it opens in Mail as expected)
I've changed all the permissions as explained in the original site. Is there something I'm missing that would get the .emlx file to open automatically? (Does this need to be changed because of 10.10?)
UPDATE
As a temp fix, I've reverted to using a folder action but I'd still like to figure out what LSOpenURLsWithRole() failed with error -10810 is all about

I suggest to use Mailtrap instead. All you need to do is configure SMTP to use their server:
Host: mailtrap.io
Port: 25 or 465 or 2525
Username: your-username
Password: your-password
Auth: PLAIN, LOGIN and CRAM-MD5
TLS: Optional
All emails will be sent to Mailtrap regardless of the email address. You will then be able to access sent messages on mailtrap.io, you can view the message in HTML and text format, run an analysis on the message, etc.

Related

PHPmailer Authentication is set to False, but Authentication was still required

I am trying to send an Email to alert users of a file being imported.
In the PHP script, I have added "$mail->SMTPAuth=False", but I get the following error when trying to run the script: "SMTP ERROR: MAIL FROM command failed: 553 authentication is required"
If I run this script on a different machine, the SMTP error from above will not appear. I have tried and copied settings from the working machine, but on my own machine it still gives 553 error. I have ask the Email Server Admin regarding any special permission given to the working machine, but there was none. Are there any other settings I need to check?
Currently, I have matched all environmental variables and php's folder content from the working machine.
Credit to #Synchro
Turning off auth in your script will not work if the server requires it, and that's where the error is coming from. It could be requiring auth if you're not on its local network, which would explain the discrepancy between the two locations.

EmailQueue not sending mail: "cannot find the path specified" in Windows

I am using the emailqueue by lorenzoherrera,
I have installed the setup in the windows 7 and executed the script and getting the error
The system cannot find the path specified
PHPMailer error : <strong> Could not execute : /var/qmail/bin/sendmail </strong>
This seems the linux path setting, what, how and where do I have to modify for windows setting, I am having no idea what to do.
Tough the db is showing the mail as send.
For it to even be looking at that path means it's being told to send via qmail, which you won't have on Windows. You need to alter the code that calls PHPMailer so that it's told to send either via a local mail server (using isMail()), or directly via SMTP using isSMTP(), along with appropriate login credentials. It sounds like this is a misconfiguration in EmailQueue, so I suggest you contact them for support - PHPMailer is only doing what it's told.

Drupal - PHP SMTP Settings are correct but email will not send

I get the following error when my Drupal site tries to send out a welcome email when users are signed up: Failed to connect to mailserver at "secure.emailsrvr.com" port 465, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set()
I at first set the following in PHP.ini:
SMTP = secure.emailsrvr.com
SMTP_PORT = 465
sendmail_from = support#managerspitstop.com
username = support#managerspitstop.com
password = ****
But I still got the error above so I added the following into the mail.inc file which is a file within the Drupal site:
ini_set("SMTP","secure.emailsrvr.com");
ini_set("smtp_port","465");
ini_set("username", "support#managerspitstop.com");
ini_set("password", "*****");
ini_set("sendmail_from", "support#managerspitstop.com");
But still get the same error. So I contacted Rackspace who I have set up the email with and they have told me the settings I am using are correct. To test this I added the email to Outlook 2013 send out and email and received an email just fine.
I have looked around and couldn't find a solution. Any help will be greatly appreciated.
Please note that this is just a hint for better investigation means, not an answer.
It would be beneficial to make a packet-level inspection of what exactly is going on at the time, when you try to send e-mail out.
For this, install tcpdump:
apt-get install tcpdump
and start a packet capture (run as root):
tcpdump -i any -s 0 -w /tmp/sniff-465.pcap port 465
Perform steps necessary to attempt the e-mail submission to the SMTP server, wait for the response and stop the packet capture by pressing CTRL+C. The resulting file (/tmp/sniff-465.pcap) can be analysed (using wireshark, i.e.) for exact behavior of the attempted SMTP transaction.
BLOODY DRUPAL! Managed to get it working. Turns out my email settings were correct the whole time.
I fixed it by downloading Drupals SMTP module which I placed in httpdocs/sites/all/modules/smtp and then I downloaded phpmailer version 2.2.1 (only required if you are running Drupal 6.x and do not use a version of PHPMailer any higher than 2.2.1 as it will not work) https://github.com/PHPMailer/PHPMailer/releases/tag/v2.2.1 I placed this at httpdocs/sites/all/modules/smtp/phpmailer.
Once that was sorted I went into the Administration section of my Drupal site and went to the modules section and typed in the email settings and BAM it worked :D.

DokuWiki on Windows wont send email

I set up DokuWiki on a Windows 2012 Server using wampserver
It works really well, but I can't get it to see any smtp server. I set up a local server using IIS, tested it using blat. I added the following lines to the php.ini:
SMTP = localhost
smtp_port = 25
sendmail_from address#host.com
I also tried using the computer's domain as the server, but Doku won't send any email. Looking at Doku's wiki, I found these helpful instructions: dokuwiki email, but I always get an error that says "Looks like there was an error on sending the password mail. Please contact the admin!"
I also tried the 'fake sendmail', but it gave me the same result.
I reset Apache and IIS after changing the configs, but there was no change. There is nothing in the log files either.
As far as I can tell, this should work. Is there another config file or something else that I missed?
Thanks,
Well, just pointing PHP to localhost for a mail server won't work unless you run a mailserver there.
You have three options:
configure your php.ini to point to a mail server on your LAN
run a local Mailserver (eg. http://www.pendriveapps.com/portable-smtp-server-mini-relay/)
use the swiftmail plugin (https://www.dokuwiki.org/plugin:swiftmail) to configure DokuWiki to use some other external mailserver (eg. gMail).

Why does this PHP error reference localhost?

I'm running XAMPP on my local machine and on a server in the office. Both are Windows machines.
I'm writing some code that uses mail() to send email from a form. By default, it uses sendmail.exe (which comes with XAMPP) to send the email. In all cases, the mail is actually sent via a third machine, which is the Exchange server.
From my local machine, PHP can send mail just fine. On the server, upon form submission I get this error:
Warning: mail() [function.mail]:
Failed to connect to mailserver at
"localhost" port 25, verify your
"SMTP" and "smtp___port" setting in
php.ini or use ini_set() in
... followed by my filename.
I don't understand why it's referencing "localhost." Nowhere in php.ini or sendmail.ini does is "localhost" used - I use the name of the mail server. The SMTP information used on both machines is the same.
As far as I can tell, the two environments have everything important in common:
The php.ini files are identical
The sendmail.ini files are identical
Both machines have the same version of XAMPP installed
The same batch script will run on both machines and successfully send email via sendmail.exe
I have stopped and started Apache several times to make sure it's using the updated config files.
When I get the error above, I notice that no log file is produced by sendmail.exe, which makes me think it's never run.
What am I missing?
Solved
My problem was that I thought it was using c:\xampp\php\php.ini, but it was actually using c:\xampp\apache\bin\php.ini. This should have been obvious, and I had previously edited the correct file on my local machine, but somehow I got confused when making the changes on the server.
Using php_info() showed me which config file was loaded, and I edited the correct one. It's working now! Thanks everyone for your help.
You should add a call to phpinfo() in your page, and check that:
Your PHP script is using the correct php.ini
Check that the SMTP ini settings (as displayed in the phpinfo tables) are correct.
Try to use this in the code on server:
ini_set("SMTP","smtp.example.com" );
ini_set('sendmail_from', 'user#example.com');
I had to do this also - you need to sent up the sendmail.ini:
Your sendmail.ini should be located in C:\xampp\sendmail\sendmail.ini.
You only need to be concern with 3 variables here:
1.smtp_server
2.auth_username
3.auth_password
Details are here: Send mail and xampp
Bill H

Categories