Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
can someone tell me why, when i try to send an e-mail using MIME lite it keeps on returning 'no data in this part'. The attachment exists, code is as follows

#!c:\Perl\bin\perl5.8.0.exe # Rob Waite 09/2003 # generate AVS data from Helpful Holidays use CGI; use Sprite; use LWP::Simple; use DBI; use Time::Local; use File::Copy; use MIME::Lite; use LWP::UserAgent; $ua = new LWP::UserAgent; $timeout = 60; # *************************** get descriptions & photos ******** +*********************** # &get_date; &desc; # &get_star; # &array_onde; # &get_AVS; # &email; $ondefile = "C:/tmp/onde.txt"; sub desc { $logfile = "C:/tmp/HHOL/LOG.".$$; $property = 1; &get_date; open(HHOL, "C:/tmp/HHOL/HHOL.txt") || die ("unable to open HHOL fi +le"); while(my @HHOLid = split /=[^\n]*\n/, <HHOL>) { foreach $HHOLid (@HHOLid) { print ("Property $property: $HHOLid \n"); $tmp = "C:/tmp/HHOL/Text/HHOL-".$HHOLid.".txt"; $src = "http://www.helpfulholidays.com/property.asp?ref=". +$HHOLid."&year=".$year; sleep (rand 10); $_ = get($src); $star_ = $_; if ($_ =~ /No Active/) { print ("$HHOLid does not exist on Helpful Holidays\n") +; open(LOG,">>$logfile"); print LOG "Proprty: ".$HHOLid." does not exist on Help +ful Holidays\n"; close LOG; } else { $pic_ = $_; @dat = split(/Provisionally book this Property">/, $_) +; $_ = $dat[1]; @dat = split(/<\/DIV>/i, $_,); $_ = $dat[0]; $_ =~ s/<[^>]*>//g; $_ =~ s/\s/ /g; $_ =~ s/ / /gs; $_ =~ s/ +//gs; $_ =~ s/\&[^\;]*\;//g; $_ =~ s/\.\.\. a/\n\nA/g; $_ =~ s/\.\.\.a/\n\nA/g; $_ =~ s/\.\.\. b/\n\nB/g; $_ =~ s/\.\.\. /\n\n/g; $_ =~ s/ ½ / 0.5 /g; $_ =~ s/½|½./.5 /g; $_ =~ s/ ¼ / 0.25 /g; $_ =~ s/¼|¼./.25 /g; $_ =~ s/ ¾ / 0.75 /g; $_ =~ s/¾|¾./.75 /g; $_ =~ s/ \././g; $_ =~ s/ ,/,/g; $_ =~ s/ \;/;/g; $_ =~ s/'|'/'/g; $_ =~ s/"|"/"/g; if (@dat = split(/Other properties/,$_)) { $_ = $dat[0]; } &star; open (TD, ">$tmp"); print TD "Star rating: ".$star."\n +\nSleeps: ".$sleeps."\n\nBedrooms: ".$beds."\n\n".$_."\n\nChangeover +Day: ".$change."\n\nThese star ratings are unique in that they rely e +normously heavily on the experience of the inspectors, members of our + staff who have seen hundreds of houses. They check everything we can + think might be relevant to your holiday enjoyment, from basic cleanl +iness to whether the colour of the curtains goes with the duvet cover +s, and then they grade the property on the basis of all of these thin +gs. They remain, however, strictly personal assessments, in the best +of faith, of interior quality and ambience only. They have nothing to + do with the outward appearance or situation. Nor are they necessaril +y directly related to the quality or quantity of 'gadgets'. Tick boxe +s ? ... well, some, yes, but mostly it's about ambience, tone and com +fort, all looked at with a good dollop of common sense.\n\nProperties + rated 5 star now would have been miles off the scale 10 years ago an +d as standards continue to charge upwards we constantly review to ens +ure that our star ratings remain useful. The greatest praise of them +is, perhaps, the degree to which our customers of many years tell us +they rely on our star ratings ABOVE ALL ELSE in their search for a pe +rfect holiday place. The fact they have been appreciated by so many p +eople for so many years makes us feel we are doing something right.\n +\n1 Star means what we would call 'basic', i.e. it has all the basic +necessities but contains little or nothing that is new or smart. Howe +ver, it may well have charm. A surprising number of people say 'basic +' is what they want.\n\n2 Star is better furnished and equipped: ofte +n very pleasant, quite attractive and friendly - just a little old fa +shioned. Or, alternatively, more functional than beautiful.\n\n3 Star + good quality and thoroughly efficient, a considerable and successful + effort made to make it attractive; well-equipped; almost always fitt +ed kitchens.\n\n3 and a half Stars means better quality.\n\n4 Star me +ans excellent, 'own home' feeling, very good quality, attractive and +well furnished and probably (though not necessarily - see individual +descriptions) extremely well-equipped; or in some other way special.\ +n\n4 and a half Star means all that and more.\n\n5 Star means excepti +onal.\n\nMore people say we malign places than that we over-rate them +. And please don't forget 1 and a half and 2 Star properties may be +in marvellous situations."; close TD; &email; @pics = split(/Additional Pictures and Videos:/, $pic_ +, 2); $pic_ = $pics[1]; @pics = split(/<img src="media\//, $pic_, 2); $pic_ = $pics[1]; @pics = split(/.jpg" /, $pic_, 2); $tp = $pics[0]; $str = "\"$tp\", \"\","; $count = 1; while ($count < 5) { $pic_ = $pics[1]; @pics = split(/<img src="media\//, $pic_, 2); $pic_ = $pics[1]; @pics = split(/.jpg" /, $pic_, 2); $pic_ = $pics[0]; if ($pic_ ne "") { $str = $str." \"".$pic_."\", -".$count.","; } $count++; } %letter = eval($str); while (($lett, $num) = each(%letter)) { $tmp2 = "C:/tmp/HHOL/Pics/HHOL-".$HHOLid.$num.".jp +g"; $pic = "http://www.helpfulholidays.com/media/".$le +tt.".jpg"; print ("$pic\n"); sleep (rand 15); getstore($pic, $tmp2); # if (open($tmp2)) { # &emailpics; # } } } } $property++; die "Just a test\n"; } } sub email { $filename = "HHOL-".$HHOLid.$num.".jpg"; print ("$filename\n"); $msg = MIME::Lite->build( From => 'chinecot@btopenworld.co.uk', To => 'waiterm@hotmail.com', Subject => 'HC 0', Type => 'Multipart/mixed'); $msg->attach( Type => 'text image/jpg', Path => $tmp2, Filename => $filename, Disposition => 'attachment'); $msg->send('smtp', "mail.btopenworld.com"); } sub emailpics { $filename = "HHOL-".$HHOLid.".txt"; $msg = MIME::Lite->build( From => 'chinecot@btopenworld.co.uk', To => 'waiterm@hotmail.com', Subject => 'HC 0', Type => 'Multipart/mixed'); $msg->attach( Type => 'text file/txt', Path => $tmp, Filename => $filename, Disposition => 'attachment'); $msg->send('smtp', "mail.btopenworld.com"); }

janitored by ybiC: Balanced <readmore> tags around loooong code block


In reply to email attachments using multipart MIME format by waiterm

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others examining the Monastery: (4)
As of 2024-04-25 04:43 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found