Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7577039
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T17:05:03+00:00 2026-05-30T17:05:03+00:00

All, I have the standard mail code to send an email in PHP. $to

  • 0

All,
I have the standard mail code to send an email in PHP.

$to = $resultset['email_address'];
$subject = "New client inquiry from Website.com";
$message = $email_message;
$from = $your_email;
$headers = "From:" . $from;
mail($to,$subject,$message,$headers,"-f $from");

The variables are created earlier in my code. However what I want to check is to make sure that the mail function was executed successfully. With this code, how can I determine if sent the email and if it didn’t echo out “failure”?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T17:05:04+00:00Added an answer on May 30, 2026 at 5:05 pm

    Simply said: This is not possible with the PHP mail() command.

    the return value from mail() just indicates, whether the mail was successfully handed over to the MTA, but not if it was sent. If e.g. your MTA is postfix, and the postfix service is stopped, mail() will happily return true, as queueing the mail to postfix worked. It will however never be sent, if postfix is not manually started (or even correctly configured).

    If you really want to make sure, the mail has been sent, you need to talk to a MTA via sockets. There are frameworks for that.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have used all the Standard Network related code for Getting Images of about
We have a coding standard that says all shared (static) fields and methods must
Looking at the DateTimeFormatInfo documentation, it appears that all the standard formats have colons
Suppose I have a customer object that has all of the standard customer properties
As far as I understand, all the built-in standard apps like (email, music, calendar
HTML Email is a whole different ballgame from Websites , which have moved away
I have a third party program which basically allows users to send email and
I am distributing an app that uses the Python/C API. I have all standard
I'm using post-receive-email hook from the Git distribution to send e-mails to certain users
We all have the good habit of documenting our code, right? Nowadays, in-code documentation

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.