Do you know where your variables are? | |
PerlMonks |
Manipulating mail parts from Sendmail's queueby chanakya (Friar) |
on Jun 28, 2005 at 05:45 UTC ( [id://470493]=perlquestion: print w/replies, xml ) | Need Help?? |
chanakya has asked for the wisdom of the Perl Monks concerning the following question:
Greetings All My new task is to manipulate the emails from the Sendmail's queue. The basic idea is to add image to the top and bottom of the email. Before moving further an idea about how Sendmail stores incoming mails. The mail queue is a directory that stores data and controls files for mail messages that the sendmail command delivers. By default, the mail queue is /var/spool/mqueue. Each message in the queue has a number of files associated with it. The files are named according to the following conventions: d The data file containing the message body without the heading information. q The queue-control file. This file contains the information necessary, and mail header information to process the job.
The files starting withq will hold the mail header information The q file for a message sent to amy@zeus would look similar to: The files starting with d will hold the mail body The d file for a message sent to amy@zeus would look similar to: If a user sent a mail to my host, then I'll be having 2 parts of the email in the /var/spool/mqueue, with the following format: dfj5RAnuBt013914 qfj5RAnuBt013914 Now, coming to the task, I need to get two parts of the email in my script, get the content-type and if the type is "text/html" or "multipart/alternative" then add an image after the <body> tag and move the two mail parts to /var/spool/mqueue_manip Can someone give idea about getting the mail part contents (dfj5RAnuBt013914, qfj5RAnuBt013914) with the same number(ex:dxxxxxxx013914, qxxxxxx013914) into two different variables. Also, remember that there may be many files starting with d, q with different numbers. This is what I've tried until now: Can someone let me know how to get the matching email parts..and also how to update the email part with the embedded image data on top and bottom of the mail part..? Thanks in advance
Back to
Seekers of Perl Wisdom
|
|