Sending mail error in PHP on IIS - php

I am using a small script of php to send email through my IIS based server. When I try to send mail an error occurrs:
"The specified CGI application exceeded the allowed time for processing. The server has deleted the process."
Although simple php script is working fine, my sample code is given below.
<?php
if(mail('sheery_1#hotmail.com','test subject','test message')){
echo('ok');
} else{
echo('not ok');
}
?>

You must configure your home server as this feature is ready pre configured on hosting servers.
Try to change the php.ini and change the smtp paths etc

Related

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.

Cannot receive emails from Debian server

I have an issue regarding debian server. The same code I uploaded on cloud server and the contact form (with php) is working properly and is sending email.
I tested exactly the same code in our server in the office with Debian and it does not shows any error but we could not accept emails from contact form.
Thank you in advance
You can't send emails from local server directly
You can take a look at this question
Send email from localhost
localhost term means it's not equipped with mail capability
even though you can try this code to know if it has built in mail server or not
if (mail('email address','subject','message') === true){
echo 'SENT';
}else{
echo 'NOT SENT';
}

How to get PHP to send mail to local users (cakePHP, Linux SLES)

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.

Cannot get email script working

Here is the code I have in contact.php:
<?php
mail('philovesdogs#gmail.com','sdf','sadfsad');
echo 'Ok';
?>
I put the echo in just to make sure that PHP was working on the page. I uploaded the page to my LAMP server and opened the page. I saw ok. I checked my email however (and my Spam folder) and no email was sent.
You need to configure and keep running SMTP server. Review questions like this: Configuring LAMP to Send Mails

PHP = > if (mail) + timeout?

I have a simplistic webform running on bluehost that when submitted, sends out mail to a distribution list.
Recently the mail server went down, and my php mail script hung when the submit button was clicked. The user tried one more time, and again the page just hung. Later when the mail server came back up, it sent out multiple copies of the mail.
My question is, is there an easy way to put some sort of timeout on the script, so that if either a set period of time passes and the mail server has not acknowledged the request, or alternatively, if the number of unsuccessful attempts has exceeded a preset number, then the script will stop attempting to send the mail?
My script:
// try to send email
if (mail($to,$subject,$msg,$headers)) {
header('Location: complete.php');
} else
{
header('Location: incomplete.php');
}
Thanks for any advice you may be able to give,
Rich.
PS. I do not have access to change any settings on the server, although I do have a .htaccess file saved to the local directory.
This is not possible. You may want to have a look at phpmailer which is way more advanced than the built-in mail() function php provides.
mail() always returns true if the mail has been submitted to the mailserver (and actually should not hang when the mailserver is down, but return false).

Categories