I’m polling emails from a mailinglist to discourse, the subjects of the mails generate new topics. That’s working fine.
Now I need to remove the first part of the subject, as it’s just the name of the mailinglist
“[mailinglist] actual topic” and I want to extract just the “actual topic”
I couldn’t find the right solution online so far - anyone?
Thank you,
marko
I changed the mbox/importer.rb using the corrected RegEx and also tried a static replace string without any change of the incoming topics.
I’ll try to clarify:
I subscribed the email-adress of the related dicourse category (custom address for incoming e-mails; √ category mirrors mailing-list) to the existing mailing-list
discourse receives this mails and creates according topics
as the mailing-list adds a prefix to the email-subject, I want to remove it before discourse creates the topic
My questions now
is ./script/import_scripts/mbox/importer.rb the correct importer?
is the .gsub("remove this prefix ","") syntaxt right?
I tried mapped[:title] = row['subject'].strip[0...255].gsub(/^\[(.*?)\]\s/,"")
The importer has nothing to do with this. You will need a plugin (shouldn’t be more than a couple lines of code) or a consumer for the topic_created webhook which could use the API to modify the topic title.