send email

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Cecil1984
    New Member
    • Mar 2008
    • 9

    send email

    hi guys,
    could any one help me how to write perl script to send email in unix system.

    thank you for any helping.
  • eWish
    Recognized Expert Contributor
    • Jul 2007
    • 973

    #2
    Look into using the Mime::Lite or Mail::Sendmail modules which make it easy. Also, if you search the forum you will find posts with the code to an send email. We will help you if you get stuck.

    --Kevin

    Comment

    • Cecil1984
      New Member
      • Mar 2008
      • 9

      #3
      thanks for your replying, i checked the link which you gave me. i think i just confused my question, my question is : for example, once you did wrong password in unix, the email would be sent to you. i think the email destination is unix's file, like using 'mail' to check the email in unix.

      Comment

      • KevinADC
        Recognized Expert Specialist
        • Jan 2007
        • 4092

        #4
        Originally posted by Cecil1984
        thanks for your replying, i checked the link which you gave me. i think i just confused my question, my question is : for example, once you did wrong password in unix, the email would be sent to you. i think the email destination is unix's file, like using 'mail' to check the email in unix.
        Do you know any perl?

        Comment

        • Cecil1984
          New Member
          • Mar 2008
          • 9

          #5
          yes, i just begin to learn perl, so any help for me to write the script. thanks very much.

          Comment

          • numberwhun
            Recognized Expert Moderator Specialist
            • May 2007
            • 3467

            #6
            Originally posted by Cecil1984
            yes, i just begin to learn perl, so any help for me to write the script. thanks very much.
            I think that the point that was being made to you is that you need to show us some code. We can provide guidance on modules, but you are going to have to write the code yourself. We will then help you if you get stuck.

            Regards,

            Jeff

            Comment

            • Cecil1984
              New Member
              • Mar 2008
              • 9

              #7
              thanks for reply, my script as following

              [CODE=perl]open (SENDMAIL, "| /usr/lib/sendmail -t -n -oi");
              print SENDMAIL "From: user\@domain.co m\n";
              print SENDMAIL "To: root@domain.com \n";
              print SENDMAIL "Subject: testing 123\n\n";
              print SENDMAIL "Body: hello every\n";
              close (SENDMAIL);[/CODE]

              but i do not why when i run the script, i can not stop the program, there are many '&EFO' at the end of the program.
              Last edited by eWish; Mar 30 '08, 02:36 PM. Reason: Please use code tags

              Comment

              • KevinADC
                Recognized Expert Specialist
                • Jan 2007
                • 4092

                #8
                Originally posted by Cecil1984
                thanks for reply, my script as following

                [CODE=perl]open (SENDMAIL, "| /usr/lib/sendmail -t -n -oi");
                print SENDMAIL "From: user\@domain.co m\n";
                print SENDMAIL "To: root@domain.com \n";
                print SENDMAIL "Subject: testing 123\n\n";
                print SENDMAIL "Body: hello every\n";
                close (SENDMAIL);[/CODE]

                but i do not why when i run the script, i can not stop the program, there are many '&EFO' at the end of the program.
                the sendmail stuff looks OK. But nobody here will know why your program that we can not see will not stop.

                Comment

                Working...