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

does attachment work with sendmail

Expand Messages
  • Samir Sudrik
    I am use following code to send mail from my server. Can i send attachment using the same code? use CGI; $dataIn=new CGI; $dataIn- header();
    Message 1 of 6 , Jun 29, 2001
    • 0 Attachment
      I am use following code to send mail from my server. Can i send attachment using the same code?
       
       
       
      use CGI;
      $dataIn=new CGI;
      $dataIn->header();
      $requestType=$dataIn->param('requestType');
      $txtto=$dataIn->param('txtto');
      $txtfrom=$dataIn->param('txtfrom');
      $txtsub=$dataIn->param('txtsubj');
      $txtmess=$dataIn->param('txtmess');
       

      $from=$txtfrom;
      $to=$txtto;
      $subject=$txtsub;
      $sendmailpath =  "/usr/lib/sendmail";
       
      open (SENDMAIL, "| $sendmailpath -t") || die("Couldn't connect to Exim($!)");
      print SENDMAIL "Subject: $subject\n";
      print SENDMAIL "From: $from\n";
      print SENDMAIL "To: $to\n\n";
      print SENDMAIL "$txtmess\n\n";
      print SENDMAIL "Bye!\n\n";
      print SENDMAIL "$from\n";
      close (SENDMAIL);
      regards,
      samir
    • Bob Showalter
      ... attachment using the same code? ... I suggest you look at the MIME::Lite module from CPAN. It handles multipart email nicely. Why reinvent the wheel?
      Message 2 of 6 , Jun 29, 2001
      • 0 Attachment
        --- In perl-beginner@y..., "Samir Sudrik" <samir_zs@y...> wrote:
        > I am use following code to send mail from my server. Can i send
        attachment using the same code?
        > ...

        I suggest you look at the MIME::Lite module from CPAN. It handles
        multipart email nicely. Why reinvent the wheel?
      • Frank J. Schmuck
        I understand the need to use strict when first writing code but I’m not sure if I understand how to fold things back in after testing. As an example: $y =
        Message 3 of 6 , Jun 29, 2001
        • 0 Attachment

          I understand the need to use strict when first writing code but I’m not sure if I understand how to fold things back in after testing.  As an example:

           

          $y  = 0;  will receive the following error : Global symbol "$y" requires explicit package name at line number x

          my  $y = 0;  will not.

           

          $y = $i = 0; will receive the same error.

          my $y = $i = 0; will receive the same error

          my $y = 0;

          my $i = 0;  will not.

           

          Does this mean that all declared vars under “strict” must be declared as “my” and that each one must be declared one-at-a-time?

           

          Thanks

          Frank

           

           

           

        • erik.tank@bpxinternet.com
          I know that there is a way to do it, but you need to use MIME standards. I have never done it directly, but the MIME::Lite module from CPAN does this. You
          Message 4 of 6 , Jun 29, 2001
          • 0 Attachment
            I know that there is a way to do it, but you need to use MIME standards.  I have never done it directly, but the MIME::Lite module from CPAN does this.  You might want to check it out, it uses sendmail by default and the man page is excellent in that it has extensive examples on how to use it.
             

            Erik Tank
            602-817-4705
            erik.tank@...

            -----Original Message-----
            From: Samir Sudrik [mailto:samir_zs@...]
            Sent: Friday, June 29, 2001 3:59 AM
            To: perl-beginner@yahoogroups.com
            Subject: [PBML] does attachment work with sendmail

            I am use following code to send mail from my server. Can i send attachment using the same code?
             
             
             
            use CGI;
            $dataIn=new CGI;
            $dataIn->header();
            $requestType=$dataIn->param('requestType');
            $txtto=$dataIn->param('txtto');
            $txtfrom=$dataIn->param('txtfrom');
            $txtsub=$dataIn->param('txtsubj');
            $txtmess=$dataIn->param('txtmess');
             

            $from=$txtfrom;
            $to=$txtto;
            $subject=$txtsub;
            $sendmailpath =  "/usr/lib/sendmail";
             
            open (SENDMAIL, "| $sendmailpath -t") || die("Couldn't connect to Exim($!)");
            print SENDMAIL "Subject: $subject\n";
            print SENDMAIL "From: $from\n";
            print SENDMAIL "To: $to\n\n";
            print SENDMAIL "$txtmess\n\n";
            print SENDMAIL "Bye!\n\n";
            print SENDMAIL "$from\n";
            close (SENDMAIL);
            regards,
            samir

            Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
          • erik.tank@bpxinternet.com
            When using strict you do need to declare every variable. You can instantiate several variables at the same time: my $a, $b, $c, $d; Then you can use them
            Message 5 of 6 , Jun 29, 2001
            • 0 Attachment
              When using strict you do need to declare every variable. 
              You can instantiate several variables at the same time:
              my $a, $b, $c, $d;
              Then you can use them without threat of getting an error. 
               
              You can instantiate and assign a single variable in one line, but you are not able to instantiate and assign multiple variables in one line.
              Usually the syntax is that you instantiate each variable separately when you actually assign it a values:
              my $i = 1;
              my $y = $i; # works because $i is already instantiated
              my $z = $y = $i = 3; # works because $y and $i are already instantiated.
               

              Erik Tank
              602-817-4705
              erik.tank@...

              -----Original Message-----
              From: Frank J. Schmuck [mailto:fschmuck@...]
              Sent: Friday, June 29, 2001 7:22 AM
              To: perl-beginner@yahoogroups.com
              Subject: [PBML] Declaring Vars under "Use Strict"

              I understand the need to use strict when first writing code but I’m not sure if I understand how to fold things back in after testing.  As an example:

               

              $y  = 0;  will receive the following error : Global symbol "$y" requires explicit package name at line number x

              my  $y = 0;  will not.

               

              $y = $i = 0; will receive the same error.

              my $y = $i = 0; will receive the same error

              my $y = 0;

              my $i = 0;  will not.

               

              Does this mean that all declared vars under “strict” must be declared as “my” and that each one must be declared one-at-a-time?

               

              Thanks

              Frank

               

               

               


              Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
            • Greg
              ... standards. I ... does this. ==================================================== RFC1341 http://www.w3.org/Protocols/rfc1341/7_2_Multipart.html explains
              Message 6 of 6 , Jul 2, 2001
              • 0 Attachment
                --- In perl-beginner@y..., erik.tank@b... wrote:
                > I know that there is a way to do it, but you need to use MIME
                standards. I
                > have never done it directly, but the MIME::Lite module from CPAN
                does this.
                ====================================================
                RFC1341

                http://www.w3.org/Protocols/rfc1341/7_2_Multipart.html

                explains how to include mime types in e-mail and html pages.

                Greg Smith
                webmaster
                www.bmw-club.org.uk
                www.uksites4all.co.uk
              Your message has been successfully submitted and would be delivered to recipients shortly.