[x]
Posted via EE Mobile

Search, ask, and monitor your questions on the go with EE Mobile. Visit Experts Exchange from your mobile device and never be out of touch again.

Question
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

4.0

PHP email file attachments

Asked by hegde123 in PHP Scripting Language

Tags: php, attachment, email, file

Hi
   i'd like to know if anyone has the code to be able to attach and email excel files using PHP. Basicallywhat i have is a process that opens an excel file on a directory on a windows machine and writes data to the file. What i need is something that emails the excel file as an attachement at the end of this process. I can get the email process working where it emails a message, but am having trouble emailing attachments. I've attached the current email function.

function send_email($to,$from,$reply,$subject,$msg,$host,$port,$domain,$priority,$output)
    {
     if (!$host) { $host = ""; }
     if (!$port) { $port = "25"; }
     if (!$priority) { $priority = "1"; }
     if (!$reply) { $reply = $from; }

     $STATUS_OK = "2";
     $STATUS_DATA_OK = "3";
     $CRLF = "\r\n";

     // Pull out the simple email if they are putting in 'name <email@domain.com>'
     if (ereg("(([[:alnum:]]|\\-|\\.)+@([^[:space:]]*)([[:alnum:]-]))", $to, $reg_array))
         {
          $to = $reg_array[0];
         }

     if ($socket = fsockopen($host, $port))
         {
          list($status, $resp_msg) = each(read_response($socket,$output));
          if ($status == $STATUS_OK)
              {
               fputs($socket, "HELO" . $CRLF);
               list($status, $resp_msg) = each(read_response($socket,$output));

               if ($status == $STATUS_OK)
                   {
                    fputs($socket, "MAIL FROM:" . $from . $CRLF);
                    list($status, $resp_msg) = each(read_response($socket,$output));

                    if ($status == $STATUS_OK)
                        {
                         fputs($socket, "RCPT TO: " . $to . $CRLF);
                         list($status, $resp_msg) = each(read_response($socket,$output));
                         if ($status == $STATUS_OK)
                             {
                              fputs($socket, "DATA" . $CRLF);
                              list($status, $resp_msg) = each(read_response($socket,$output));

                              if ($status == $STATUS_DATA_OK)
                                  {
                                   $buffer = "From: $from$CRLF";
                                   $buffer .= "To: $to$CRLF";
                                   $buffer .= "Reply-To: $reply]$CRLF";
                                   $buffer .= "Errors-To: $reply$CRLF";
                                   $buffer .= "Bounce-To: $reply$CRLF";
                                   $buffer .= "X-Priority: $priority$CRLF";
                                   $buffer .= "X-Mailer: Zap Mailer w/PHP " . phpversion() . $CRLF;
                                   $buffer .= "Subject: $subject$CRLF";
                                   $buffer .= $CRLF;
                                   $buffer .= $msg;

                                   if ($output == "Y")
                                       {
                                        echo nl2br($buffer);
                                       }

                                   if (fputs($socket, $buffer . "$CRLF.$CRLF"))
                                       {
                                        list($status, $resp_msg) = each(read_response($socket,$output));

                                        if ($status == $STATUS_OK)
                                            {
                                             $send_success = true;
                                             fputs($socket, "QUIT" . $CRLF);
                                            }
                                       }
                                  }
                             }
                        }
                   }
              }
          fclose($socket);
         }
    }
[+][-]11/01/02 10:38 AM, ID: 7397590Accepted Solution

View this solution now by starting your 30-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

About this solution

Zone: PHP Scripting Language
Tags: php, attachment, email, file
Sign Up Now!
Solution Provided By: CyberMatrix
Participating Experts: 3
Solution Grade: B
 
[+][-]10/30/02 05:40 PM, ID: 7390276Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]10/30/02 05:44 PM, ID: 7390287Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]10/30/02 05:47 PM, ID: 7390296Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]10/30/02 07:28 PM, ID: 7390561Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]10/30/02 07:40 PM, ID: 7390592Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]10/30/02 08:05 PM, ID: 7390662Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]10/31/02 03:13 AM, ID: 7391544Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]10/31/02 02:00 PM, ID: 7394188Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]10/31/02 02:11 PM, ID: 7394229Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]10/31/02 03:29 PM, ID: 7394518Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]10/31/02 03:30 PM, ID: 7394519Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]10/31/02 04:16 PM, ID: 7394629Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]10/31/02 04:21 PM, ID: 7394635Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]10/31/02 04:28 PM, ID: 7394658Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]10/31/02 04:32 PM, ID: 7394675Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]10/31/02 04:39 PM, ID: 7394689Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]10/31/02 04:50 PM, ID: 7394735Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]10/31/02 04:51 PM, ID: 7394739Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]10/31/02 04:53 PM, ID: 7394743Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]10/31/02 04:55 PM, ID: 7394746Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]10/31/02 06:59 PM, ID: 7395069Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]10/31/02 07:42 PM, ID: 7395153Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]10/31/02 07:52 PM, ID: 7395178Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]10/31/02 08:00 PM, ID: 7395197Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]11/01/02 01:55 AM, ID: 7395857Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]11/01/02 02:05 AM, ID: 7395882Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]11/01/02 03:08 AM, ID: 7396012Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20091111-EE-VQP-92