Loading ...
Sorry, an error occurred while loading the content.

sending mail with attachment..

Expand Messages
  • sspujari_2001
    Hi All, i am writing a code for sending mail with attachment using pear library. when i use this code in a window system it working fine but in linux system
    Message 1 of 4 , Jan 2, 2004
    • 0 Attachment
      Hi All,
      i am writing a code for sending mail with attachment using pear
      library.
      when i use this code in a window system it working fine but in linux
      system the mail has come but without attachment.

      can any body help me....?

      thanx n regards
      sspujari

      /******here is the code***************/

      require_once('Mail.php');
      require_once('Mail/Mime.php');
      ini_set("SMTP","somedomain");
      $to = "toname@...";
      $from = "fromname@...";
      $subject = "This is a test email";
      $attachment = "path\to\filename.extn";
      $headers = array('From' => $from,
      'Subject' => $subject);
      $textMessage = "test message";
      $mime = new Mail_Mime();
      $mime->setTxtBody($textMessage);
      $mime->addAttachment($attachment);
      $body = $mime->get();
      $hdrs = $mime->headers($headers);
      $mail = &Mail::factory('mail');
      $mail->send($to, $hdrs, $body);
      ?>
      /*****************End of PHP Code*****************/
    • Suraj
      sspujari_2001 wrote: ,---- ... `---- this evaluates to the string path ofilename Note that strings in double quotes are interpreted. so it should have
      Message 2 of 4 , Jan 2, 2004
      • 0 Attachment
        sspujari_2001 wrote:
        ,----
        | > $attachment = "path\to\filename.extn";
        `----

        this evaluates to the string
        "path ofilename"

        Note that strings in double quotes are interpreted. so it should have
        really been:

        'path\to\filename.extn'

        or "path\\to\\filename.extn"

        cheers,

        -Suraj

        --
        +--------------------------------------------------<suraj@...>--+
        |Discipline sustains dignity; it is |
        |like life to the body, to protect |
        |(discipline and conduct - 1), Thirukkural |
        +--<http://www.symonds.net/~suraj/>-------------------------------------+
      • Dr. Tarique Sani
        ... Either this path is wrong OR probably safe_mode restrictions are in place HTH Tarique --
        Message 3 of 4 , Jan 2, 2004
        • 0 Attachment
          sspujari_2001 wrote:

          > Hi All,
          > i am writing a code for sending mail with attachment using pear
          > library.
          > when i use this code in a window system it working fine but in linux
          > system the mail has come but without attachment.
          >
          > can any body help me....?
          >
          > thanx n regards
          > sspujari
          >
          > /******here is the code***************/
          >
          > require_once('Mail.php');
          > require_once('Mail/Mime.php');
          > ini_set("SMTP","somedomain");
          > $to = "toname@...";
          > $from = "fromname@...";
          > $subject = "This is a test email";
          > $attachment = "path\to\filename.extn";

          Either this path is wrong OR probably safe_mode restrictions are in place

          HTH

          Tarique

          --
          ===================================================================
          PHP Applications for E-Biz: http://www.sanisoft.com -o)
          /\\
          Indian PHP User Group: http://groups.yahoo.com/group/in-phpug _\_v
          ===================================================================
        • sspujari_2001
          Hi i put the file in the same current directory still i am not able to send that file as attachment. plz tell me wat is safe_mode restrictions. the mail attach
          Message 4 of 4 , Jan 4, 2004
          • 0 Attachment
            Hi
            i put the file in the same current directory still i am not able to
            send that file as attachment.
            plz tell me wat is safe_mode restrictions.

            the mail attach another text file and the content of the file is

            Content-Type: application/octet-stream
            Content-Transfer-Encoding: base64
            Content-Disposition: attachment; filename="hey.txt"
            YWRkIGF0dGFjaG1lbnQKanVzdCB0ZXN0aW5nCg==

            plz help me..

            thanx n regards
            sspujari
            IDRBT

            --- In in-phpug@yahoogroups.com, "Dr. Tarique Sani" <tarique@s...>
            wrote:
            > sspujari_2001 wrote:
            >
            > > Hi All,
            > > i am writing a code for sending mail with attachment using pear
            > > library.
            > > when i use this code in a window system it working fine but in
            linux
            > > system the mail has come but without attachment.
            > >
            > > can any body help me....?
            > >
            > > thanx n regards
            > > sspujari
            > >
            > > /******here is the code***************/
            > >
            > > require_once('Mail.php');
            > > require_once('Mail/Mime.php');
            > > ini_set("SMTP","somedomain");
            > > $to = "toname@d...";
            > > $from = "fromname@d...";
            > > $subject = "This is a test email";
            > > $attachment = "path\to\filename.extn";
            >
            > Either this path is wrong OR probably safe_mode restrictions are in
            place
            >
            > HTH
            >
            > Tarique
            >
            > --
            > ===================================================================
            > PHP Applications for E-Biz: http://www.sanisoft.com -o)
            > /\\
            > Indian PHP User Group: http://groups.yahoo.com/group/in-phpug _\_v
            > ===================================================================
          Your message has been successfully submitted and would be delivered to recipients shortly.