Hello. The program sends mail in HTML format. More precisely, should do it. Here is a piece of the program:

$innerstartHT=$objectCGI->start_html(-title=>$titcard, -base=>'true', -style=>{'src'=>$cssdadr}); $innerm="<img src=".$cardadr.">\n"; $innerm.=$gret\n; $innerm.=$lnkstr; $inner.=$innerstartHT.$innerm.$innerend; my $header ="From:<$adrm>\n"; $header.="To:<$adr>\n"; $header.="Subject:$titcard\n"; $header.="Content-Type: text/html; charset=utf-8\n"; $header.="Content-Transfer-Encoding: 8bit\n\n"; open (MAIL,"| /usr/bin/sendmail -t"); print MAIL "$header"; print MAIL "$inner"; close MAIL or die ("Oшибка $!"); 

And the letter is sent and received. But in text format. Header data

 "Content-Type: text/html; charset=utf-8\n"; "Content-Transfer-Encoding: 8bit\n\n"; 

are obtained by the body of the letter. And, accordingly, further instead of a picture, text and pr their tags are printed.
How to "explain" mail format letter?

Added.

 From:<el-ales@mail.ru> To:<el-ales@mail.ru> Subject:С Новым Годом! Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: 8bit <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" lang="en-US" xml:lang="en-US"> <head> <title>С Новым Годом! </title> <base href="http://dz12.ru/cgi/sendcard.cgi" /> <link rel="stylesheet" type="text/css" href="http://dz12.ru/css/ne.css" /> <meta http-equiv="Content-Type" content="text/html; charset=windows-1251" /> </head> <body> здесь нормально отображается рисунок </body> </html> 

    2 answers 2

    I did not particularly read it, but I see a cant - text/html .

    • Most likely this is the whole problem. - cy6erGn0m
    • Thank. I fixed it. But the problem remained - Ella
    • use strict; use warnings; my $adr='my@domain.ru '; my $ inner = 'hello <b> world </ b>'; my $ header = "From: <$ adr> \ n"; $ header. = "To: <$ adr> \ n"; $ header. = "Subject: hello html \ n"; $ header. = "Content-Type: text / html; charset = utf-8 \ n"; $ header. = "Content-Transfer-Encoding: 8bit \ n \ n"; open (MAIL, "| / usr / sbin / sendmail -t"); print MAIL "$ header"; print MAIL "$ inner"; close MAIL or die ("Error $!"); Everything works fine, checked. Perhaps your email client represents a letter from html in txt? - Anton Shevtsov
    • Yeah, and these modules - strict warnings I did not use them, maybe this is the case? And about the mail client, I receive letters in HTML format, probably the whole thing in my script - Ella
    • modules should not be, they are only for good code) try to replace the line with open with open (MAIL, "> / tmp / mymail.txt"); and after the script works, see what is in this file, and even better to show here. - Anton Shevtsov
     use MIME::Lite; my $mailer = MIME::Lite->new( Subject => $subject, From => $from, To => $to, Type => 'text/html', Data => $email, ); $mailer->send; 

    And that's all :)

    • Anyone who has paid attention to this issue - thanks a lot - Ella