• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2777
  • Last Modified:

Retrieving e-mail addresses from guestbook

Can anyone help me with a script that can retrieve e-mail addresses from my guestbook so that I may e-mail them?
0
kch011099
Asked:
kch011099
  • 4
  • 2
1 Solution
 
guadalupeCommented:
I think I can.  First you need to be a little more specific and next maybe post a sample of the Guest Book data file...
0
 
kch011099Author Commented:
Guestbook example:
-------------------------------------
I would like to thank you for an exciting season!! You are a GREAT team and you are WONDERFUL role models who display class and good sportsmanship!! Looking forward to another wonderful season next year!!
K
Kim <Kvilagi@email.net>
San Souci, FL - Sunday, January 23, 2000 at 17:23:34 (EST)
-------------------------------------

I would like to retrieve the e-mail address and put it in another file so that it can be used in a Netscape address book to send thank you e-mails.
0
 
guadalupeCommented:
A simple answer is:

open(FILE,"guest_book_dat.txt");
open (EMAILS,">emails.txt");

while (<FILE>)
{

if (/<(.+)>/)
{
    print EMAILS "$1\n";
}

}

close(FILE);
close(EMAILS);



This program will get out all the emails and print them to a txt file on per line.

Is that about what you wanted?
0
The 14th Annual Expert Award Winners

The results are in! Meet the top members of our 2017 Expert Awards. Congratulations to all who qualified!

 
guadalupeCommented:
Did this help?
0
 
kch011099Author Commented:
I couldn't get it to work. I don't think my files are being read correctly.
0
 
guadalupeCommented:
Did it give you any errors?  I used the sample you gave from your guestbook and the exact code I posted and I got the email: Kvilagi@email.net

It works for me.  Try this and see if you get any output to the screen:

open(FILE,"guest_book_dat.txt");
open (EMAILS,">emails.txt");

while (<FILE>)
{

if (/<(.+)>/)
{
    print "$1\n";
    print EMAILS "$1\n";
}

}

close(FILE);
close(EMAILS);





0

Featured Post

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

  • 4
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now