1
multimedia
perl help needed
  • 2004/5/7 1:29

  • multimedia

  • Just popping in

  • Posts: 4

  • Since: 2004/5/7 1


I need some help on perl.. I have a wonderful script for my newsletter and I am unable to send html based emails. Can you tell me what do I need to change in order to be able to send HTML emails?
The newsletter consists of several files. The main file is mailman.cgi and I am providing you with the full content of the file which is actually the main file in this web application:
#!/usr/bin/perl

#--------------------------------------------
$mailinglist = "mailinglist.sorted";
$sent = "sent.list";
$SENDMAIL='/usr/lib/sendmail';

$subject="Hello4!";

open (MESSAGE, "message.txt");
@message=;
close MESSAGE;


&bulk;
print "Content-Type: text/html\n\n\n";
print "done";

#--------------------------------------------
sub bulk {

open (LIST, "$mailinglist");
@recips = ;

foreach $recips (@recips) {
&send;

open (SENT, ">>$sent");
print SENT $recips;
close (SENT);

}
close (LIST);

}

#--------------------------------------------
sub send {

open (MAIL, "| $SENDMAIL $recips");

print MAIL "Reply-to: $recips";
print MAIL "From: $recips";
print MAIL "To: $recips";
print MAIL "Subject: $subject\n\n\n";
print MAIL "@message";

print MAIL "\n\n";

print MAIL "message generated by http://www.prolinkz.com/";
close MAIL;
}

The file with the message is "message.txt" and it supports only txt format and when I paste an HTML code the email is not recognized as an HTML email ..the receiver sees the html code.


Thanks in advance for your help!

2
Dave_L
Re: perl help needed
  • 2004/5/7 1:43

  • Dave_L

  • XOOPS is my life!

  • Posts: 2277

  • Since: 2003/11/7


You need to output a content-type header in sub send.

I think it should look like this:

print MAIL "Content-Type: text/html; charset=ISO-8859-1";


You may need additional headers too. Look at the headers of a received HTML email as a guideline.

By the way, don't all of those header prints need a \n at the end? E.g.

print MAIL "Reply-to: $recipsn";


<<< hates HTML email

3
multimedia
Re: perl help needed
  • 2004/5/7 1:48

  • multimedia

  • Just popping in

  • Posts: 4

  • Since: 2004/5/7 1


any other ideas?
btw. thx for ur responce!!!!!!!!!!

4
Dave_L
Re: perl help needed
  • 2004/5/7 2:12

  • Dave_L

  • XOOPS is my life!

  • Posts: 2277

  • Since: 2003/11/7


Ideas about what?

5
DonXoop
Re: perl help needed

Quote:

multimedia wrote:
any other ideas?
btw. thx for ur responce!!!!!!!!!!


Did that work or no?

BTW, I think you'll find more than a tiny percentage of users don't like HTML mail. Easier and more reliable to plain text it with a link to a proper HTML page via browser.

Homey don't like html email....

6
multimedia
Re: perl help needed
  • 2004/5/7 13:00

  • multimedia

  • Just popping in

  • Posts: 4

  • Since: 2004/5/7 1


DaveL: In which part of the script do I need to add this line:
print MAIL "Content-Type: text/html; charset=ISO-8859-1"; ? in the sub send { ? I tried almost everything but no result...is it possible to paste here the complete script as you think it should look like? I don't have any knowledge on perl and this is why I was asking for your help...sorry.
DonXoop: I want to use html based emails because they are more flexible and attractive and this way I could include to the newsletter graphics and extra formating.
Your help is higly appriciated.

Thank you again!

7
Dave_L
Re: perl help needed
  • 2004/5/7 17:07

  • Dave_L

  • XOOPS is my life!

  • Posts: 2277

  • Since: 2003/11/7


It would be placed in the section that prints out the other headers, e.g.:

print MAIL "From: $recips";
print 
MAIL "To: $recips";
[
color=ff0000]print MAIL "Content-Type: text/html; charset=ISO-8859-1";[/color]
print 
MAIL "Subject: $subjectnnn";


As I indicated, you may need additional headers too.

Sorry, but I don't have time to produce a complete, tested, working script here. If you don't get any additional help here, an option would be to contract someone (such as myself) to do the work.

8
multimedia
Re: perl help needed
  • 2004/5/7 19:52

  • multimedia

  • Just popping in

  • Posts: 4

  • Since: 2004/5/7 1


Dave_L: Thanks for your help. Now it works perfect I just moved it to the first line of the headers. Thank you one more time!!!

9
Dave_L
Re: perl help needed
  • 2004/5/7 22:08

  • Dave_L

  • XOOPS is my life!

  • Posts: 2277

  • Since: 2003/11/7



Login

Who's Online

311 user(s) are online (93 user(s) are browsing Support Forums)


Members: 0


Guests: 311


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Jul 31
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits