www.webdeveloper.com
Results 1 to 7 of 7

Thread: hellllppppp!

  1. #1
    Join Date
    Jan 2003
    Location
    Texas
    Posts
    20

    Question hellllppppp!

    I am trying to retrive a e-mail address from a file, input the address into my script so that I can use sendmail. I can get the address but sendmail doesn't want to send it.

    Help. Here is the code.

    open (data,"$webfile2") || die "Can't Open $webfile2: $!\n";
    @data = <data>;
    close (data);
    $fig = '\@';
    ($idnumber, $realname, $username) = split(/,/, $data[1]);
    ($user, $name) = split(/@/, $username);
    open (file,">$webfile3");
    print file "$user$fig$name";
    close (file);

    open (file,"$webfile3");
    @file = <file>;
    close (file);
    $rename = $file[0];
    $recipients = $rename;
    if ($mail eq'1'){
    open (MAIL,"|$mailprog -t") || die "Can't open $mailprog!\n";
    print MAIL "To: $recipients\n";
    print MAIL "From: $fromsender\n";
    print MAIL "Subject: $subject\n\n";

  2. #2
    Join Date
    Dec 2002
    Location
    Pleasanton, CA
    Posts
    2,132
    $mail is not set in this script.

    Does $mail eq '1' ????

  3. #3
    Join Date
    Jan 2003
    Location
    Texas
    Posts
    20

    Smile helllpppp!!!

    Yes, MAIL is set to 1

  4. #4
    Join Date
    Dec 2002
    Location
    Pleasanton, CA
    Posts
    2,132
    I meant the variable, $mail, not the file handle, MAIL

    The script as shown has syntax errors, so it will not work as shown. (no closing brace on if statement)

    Try this to make sure the mail section works.
    Code:
    $recipients = "<your email address>"; 
    $fromsender = "<your email address>"; 
    open (MAIL,"|$mailprog -t") || die "Can't open $mailprog!\n"; 
    print MAIL "To: $recipients\n"; 
    print MAIL "From: $fromsender\n"; 
    print MAIL "Subject: Test message\n";
    print MAIL "Here's my test message\n";
    close MAIL;  # not closed in your script.

  5. #5
    Join Date
    Jan 2003
    Location
    Texas
    Posts
    20

    help

    Yes $mail is set to 1. I just provided a small amount of the code.

    The script works fine if $recipients = "danny@email.net";
    I need to script to read the file $webfile3, which it does. Then read the data, it does this, then close, it does. The data that is stored in this file has about 150 line, with each line as below.
    1,danny name,danny@ltw.net
    2,dan crumpton,dan@ltw.net
    3,pam,pam@ltw.net

    etc... to 150

    I need to split out the e-mail address and then use sendmail to send an email.

    Thanks

    Danny

  6. #6
    Join Date
    Dec 2002
    Location
    Pleasanton, CA
    Posts
    2,132
    first post
    I can get the address but sendmail doesn't want to send it.
    last post
    The script works fine if $recipients = "danny@email.net";
    So what's the problem?
    I'm guessing: do you want to send all 150 emails?
    Code:
    # 'data' used for file handle AND data in your code!!!! 
    open (FIL,"$webfile2") || die "Can't Open $webfile2: $!\n"; 
    @data = <FIL>;  # 1,danny name,danny@ltw.net 
    close (FIL);
    
    foreach $line (@data) {
       chop $line; # to get rid of the return char
       ($idnumber, $realname, $address) = split(/,/,$line); 
       # if valid address set $mail = 1 here
       if ($mail eq '1'){  
         open (MAIL,"|$mailprog -t") || die "Can't open $mailprog!\n"; 
         print MAIL "To: $address\n"; 
         print MAIL "From: $fromsender\n"; 
         print MAIL "Subject: $subject\n";
         print MAIL "$message\n";
         close MAIL;
       }
    }
    exit;
    I don't know what the '$webfile3' stuff is all about.
    Good luck!

  7. #7
    Join Date
    Nov 2002
    Location
    NY, USA
    Posts
    731
    Originally posted by nedals
    chop $line; # to get rid of the return char
    You should use chomp to maintain portability.
    for(split(//,'))*))91:+9.*4:1A1+9,1))2*:..)))2*:31.-1)4131)1))2*:3)"'))
    {for(ord){$i+=$_&7;grep(vec($s,$i++,1)=1,1..($_>>3)-4);}}print"$s\n";

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles