Skip to Content
eBay Hacks, 2nd Edition
book

eBay Hacks, 2nd Edition

by David A. Karp
June 2005
Beginner
463 pages
14h 19m
English
O'Reilly Media, Inc.
Content preview from eBay Hacks, 2nd Edition

Send Automatic Emails to High Bidders

Send payment instructions to your customers automatically.

Here’s a simple script that will scan all your auctions that have ended in the last 24 hours and send a payment-instructions email to each high bidder:

             #!/usr/bin/perl
             require 'ebay.pl';
             
             $template = "template.txt";
             
             $today = &formatdate(time);
             $yesterday = &formatdate(time - 864000);
             my $page_number = 1;
             PAGE:
             while (1) {
                 my $rsp = call_api({ Verb => 'GetSellerList',
                                DetailLevel => 8,
                                     UserId => $user_id,
                                EndTimeFrom => $yesterday,
                                  EndTimeTo => $today,
                                 PageNumber => $page_number
                 });

                 if ($rsp->{Errors}) {
                   print_error($rsp);
                   last PAGE;
                 }
                 foreach (@{$rsp->{SellerList}{Item}}) {
                 my %i = %$_; 
                 ($id, $title, $currency, $price, $highbidder, $checkout) = 
                        @i{qw/Id Title CurrencyId CurrentPrice HighBidder Checkout/};

                 $bidder email = $highbidder->{User}{Email}; if ($bidderemail =~ "\@") { $shipping = $checkout->{Details}{ShippingHandlingCosts}; $total = $price + $shipping; open(MAIL,"|/usr/sbin/sendmail -t"); print MAIL "To: $bidderemail\n"; print MAIL "From: $selleremail\n"; print MAIL "Reply-To: $selleremail\n"; print MAIL "Subject: $title\n\n"; open (COVER, "$localdir/$template"); while ( $line = <COVER> ) { if ($line eq "<insert title here>\n") { print MAIL $title; } elsif ($line eq "<insert item here>\n") { print MAIL $id; } elsif ($line eq "<insert shipping here>\n") { print MAIL $currency . sprintf("%0.2f", $shipping); } elsif ($line eq "<insert total here>\n") { print MAIL $currency . sprintf("%0.2f", ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

eBay Hacks

eBay Hacks

David A. Karp
What Employees Want Most in Uncertain Times

What Employees Want Most in Uncertain Times

Kristine W. Powers, Jessica B.B. Diaz

Publisher Resources

ISBN: 059610068XErrata Page