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.
Related
Okay, so I'm new to php, and so I searched this site to find out how to send an e-mail to myself after a user fills out a contact form. I found this answer.
Send email with PHP from html form on submit with the same script
I'm using the code from the selected answer. I tried the top answer, by combining both sections into a single php page, and the second, using an html and php page, but I get the following errors:
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 (MY WEBSITE) on line 14
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 (MY WEBSITE) on line 15
"MY WEBSITE" was put there by me.
Lines 14 and 15 are these:
mail($to,$subject,$message,$headers);
mail($from,$subject2,$message2,$headers2);
Why am I getting this issue? I'm doing exactly what the poster said to do.
You are running PHP on Windows. On Unix-like systems, PHP is able to use the built-in sendmail command to send emails, and so needs no further configuration. On Windows, however, that command doesn't exist, so PHP sends email via an external SMTP server.
In order to send emails, as the error messages explain, you will need to configure your php.ini file or use ini_set() to set the SMTP and smtp_port ini settings. You'll want to specify a SMTP server and smtp_port (usually 25) that you can send email from. If you are running php from your home computer, this would probably be whatever mail server your ISP gave you. If you are are on a third-party hosting provider, you would have to get email server information from them (and they may not actually allow sending email, or may put tight controls on how much you can send, to prevent spam).
The location of the ini file is set by both configuration and convention. PHP's configuration file documentation. On Windows, a long list of registry keys is checked, before eventually falling back to C:\windows or C:\winnt, so that is where you should look for your ini file. (Running php --ini will also show where it's actually trying to read the ini file from.)
There is a sample configuration file shown in the configuration file documentation. If you don't already have a php.ini that was installed when you installed PHP, you can use that format to guide you in creating a new file.
I would bet you are on a Linux server or the host server has the mail function built in turned off. You are not with out options though.
First consider your server. If your server is a shared server and you are likely to have your mail sent to spam if it is delivered at all. Most websites will out source their message systems to keep the load off the server and to ensure delivery.
If you are not in the market for outsourcing your mail services you will need to use a library that will do most of the heavy lifting for you. I would recommend phpMailer it even has an autoset up build in with great examples on how to configure your server.
Next before you install php mailer read your host servers fine print most of them have strict rules about mail (meaning you have to keep a confirmation they wanted the email) if they let you send mail at all. They do this to keep their servers off of spam list.
Good Luck
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.
Currently I have a mail server configured (a real one from my ISP) and mail internal and external works on the command line. In PHP only external users work.
For testing I would like to send to internal users only.
( Ideally I would like to set up lots of aliases that point to one user so mail to:
tom#localhost.com, dick#localhost.com, harry#localhost.com end up in /var/mail/johnsmith )
I'd be greatful if someone could help here. I'm hesitant to edit the postfix config files...
On the command line johnsmith#localhost works but not in PHP. It's using cakePHP and I checked the value of $email-addr just before the send ($this->Email->send();) and the value is johnsmith#localhost. I'm not that familiar with cakePHP yet. The var/log/mail shows nothing, only external email addresses.
(server is Suse linux)
You can use the basic mail php function
http://php.net/manual/en/function.mail.php
Under linux, mail php function relies on sendmail, just check that sendmail is properly installed.
In /etc/postfix/main.cf add localhost.com:
mydestination = $myhostname, localhost.$mydomain,localhost,localhost.com
This allows sending on "localuser#localhost.com" via command line. I loaded up a test php mail form script in a browser and it works, sending mail through to /var/mail/localuser.
At the moment it means I have to check each local users /var/mail file. I'm working on the alias. My first attempt at that failed.
I am a newbie in Web Development an I am currently learning PHP and MySQL. I have read HeadFirst PHP and MySQL, and tried the examples. But The PHP Mail() function doesn't work on my Local Machine. I have tried the script on a web server but nothing happens, the mail isn't sent. Please Help me. I have configured the PHP.INI file to send emails but still the problem persists.
<?php
$to = "me#me.com";
$sub = "hello";
$msg = "Hello, how are you?";
//Mail Function
mail($to,$sub,$msg);
?>
I am using WebMatrix with PHP 5.2 installed. Please help me, I am trying out this one since last 2 hours! I am stuck!
mail() uses 'localhost' to send - it generally assumes it's on Linux.
You will need to aquire a basic SMTP server and run it on windows, OR you may be able to use the SMTP server of your're ISP.
Whichever option, you will need to edit your php.ini, you will find:
[mail function]
; For Win32 only.
;SMTP =
you must set SMTP to the ip/port of a mailserver - again wither run one locally or use your ISP.
EDIT
You could try this approach - I have personally never tried to use GMail for sending: http://www.linuxquestions.org/questions/programming-9/php-pear-mail-packege-support-security-through-ssl-586976/
But The PHP Mail() function doesn't work
Yes it does. The problem is either with how you configured PHP or with the MTA you configured it to use. You'd need to provide details of both for us to understand why mail is not getting sent.
The above answer also is applicable to those who use a simulated local IIS e.g. the WebMatrix on IIS Express users who reside within a corporate network with a SMTP machine available.
To be able to send emails out from within it one needs to edit the PHP.INI file (found typically in \Program Files (x86)\IIS Express\PHP\v5.3) and replace 'localhost' with the SMTP server IP or DNS name.
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