Discussion:
[Mimedefang] head->get('Subject') adds "#012"
Michael Fox
2017-10-10 02:26:52 UTC
Permalink
I'm using the following to retrieve the message subject header:



$subj = $entity->head->get('Subject');



First is there a better way?



Second, what I get back always has "#012" added to the end. For example, if
the actual subject is "foo", then the above get() method returns "foo#012".
Why is this extra "#012" appearing? And, is there a way to get just the
subject?



Thanks,

Michael




_______________________________________________
NOTE: If there is a disclaimer or other legal boilerplate in the above
message, it is NULL AND VOID. You may ignore it.

Visit http://www.mimedefang.org and http://www.roaringpenguin.com
MIMEDefang mailing list ***@lists.roaringpenguin.com
http://lists.roaringpenguin.com/mailman/
Bill Cole
2017-10-10 03:03:26 UTC
Permalink
Post by Michael Fox
$subj = $entity->head->get('Subject');
First is there a better way?
In your mimedefang-filter script? Yes. $Subject. See the 'GLOBAL
VARIABLES SET BY MIMEDEFANG.PL' section of the mimedefang-filter man
page.
Post by Michael Fox
Second, what I get back always has "#012" added to the end. For example, if
the actual subject is "foo", then the above get() method returns "foo#012".
Why is this extra "#012" appearing? And, is there a way to get just the
subject?
'perldoc MIME::Head'

The 'get' method always returns a string terminated with a newline
(octal 012)
_______________________________________________
NOTE: If there is a disclaimer or other legal boilerplate in the above
message, it is NULL AND VOID. You may ignore it.

Visit http://www.mimedefang.org and http://www.roaringpenguin.com
MIMEDefang mailing list ***@lists.roaringpenguin.com
http://lists.roaringpenguin.com/mail
Joseph Brennan
2017-10-10 14:19:47 UTC
Permalink
Post by Michael Fox
$subj = $entity->head->get('Subject');
First is there a better way?
Yes, use the $Subject variable that Mimedefang gives you!
Post by Michael Fox
Second, what I get back always has "#012" added to the end. For example, if
the actual subject is "foo", then the above get() method returns "foo#012".
Why is this extra "#012" appearing? And, is there a way to get just the
subject?
That is the actual subject-- it ends with a linefeed character, #012.
Use chomp() to remove it.



Joseph Brennan

_______________________________________________
NOTE: If there is a disclaimer or other legal boilerplate in the above
message, it is NULL AND VOID. You may ignore it.

Visit http://www.mimedefang.org and http://www.roaringpenguin.com
MIMEDefang mailing list ***@lists.roaringpenguin.com
http://lists.roaringpenguin.com/mailman/li
Michael Fox
2017-10-10 17:08:39 UTC
Permalink
Thanks to Bill and Joseph.

Michael



_______________________________________________
NOTE: If there is a disclaimer or other legal boilerplate in the above
message, it is NULL AND VOID. You may ignore it.

Visit http://www.mimedefang.org and http://www.roaringpenguin.com
MIMEDefang mailing list ***@lists.roaringpenguin.com
http://

Loading...