EPrints Technical Mailing List Archive
See the EPrints wiki for instructions on how to join this mailing list and related information.
Message: #05587
< Previous (by date) | Next (by date) > | < Previous (in thread) | Next (in thread) > | Messages - Most Recent First | Threads - Most Recent First
Re: [EP-tech] Adding a pin to a subject line using User->Mail
- To: "'eprints-tech@ecs.soton.ac.uk'" <eprints-tech@ecs.soton.ac.uk>
- Subject: Re: [EP-tech] Adding a pin to a subject line using User->Mail
- From: "Vials Moore, Adam" <Adam.Moore@liverpool.ac.uk>
- Date: Thu, 21 Apr 2016 15:53:56 +0000
Hey Yes, switching to send_mail was the solution! For anyone interested, the new call looks like this: my $result = EPrints::Email::send_mail( session => $repo, langid => $repo->get_langid, to_email => $user->get_value("email"), to_name => $repo->make_text("$edgiven $edfamily"), subject => $repo->phrase( "eprint_thesis_notify_mail_subject", subeprintid => $eprintid), message => $mail, sig => $repo->html_phrase( "mail_sig" ) ); Thanks John! Adam From: eprints-tech-bounces@ecs.soton.ac.uk [mailto:eprints-tech-bounces@ecs.soton.ac.uk]
On Behalf Of John Salter Ah… that might explain my code then… I’ve got a ‘status_change’ trigger – but I don’t use the $user->mail method (I was wondering why not!). I construct the send_mail block in the trigger sub (much like the $user->mail block does) – which works OK. Hope that helps (sorry it’s not a DRY solution!). Cheers, John From:
eprints-tech-bounces@ecs.soton.ac.uk [mailto:eprints-tech-bounces@ecs.soton.ac.uk]
On Behalf Of Vials Moore, Adam Hi John! Thanks – that puts in the value BUT then complains that the phrase is undefined – the difference between USER::Mail and send_mail being,
as far as I can see, that user->mail expects ONLY a reference to a phrase in the subject, whereas send_mail expects a UTF8 string So, the subject when it arrives now looks like this: [" [Action Required] New thesis upload by your supervisee (Ref 3000014) " not defined] Which, as far as I can understand, is a complaint that the phrase defined by the string above doesn’t exist . . . I’ve updated the code in line with your suggestions otherwise . . .
The complaint in the log would back this up [uolrepo] Undefined phrase: [Action Required] New thesis upload by your supervisee (Ref 3000014) (en) at line 124 in (eval 4489) Or have I missed something? Adam From:
eprints-tech-bounces@ecs.soton.ac.uk [mailto:eprints-tech-bounces@ecs.soton.ac.uk]
On Behalf Of John Salter Hi Adam, You can use a phrase with pins – but need to make sure you’re using a chunk of text rather than an XML fragment (possibly using the
‘phrase’ rather than ‘html_phrase’) $user->mail( $session->phrase(
“phrase_with_eprintid_pin_in_it”, eprintid => $eprintid, ), ) If you want to use other data, that’s already rendered you might need to ‘flatten’ it to use it: $user->mail( $session->phrase(
“phrase_with_users_name_pin_in_it”, users_name => EPrints::Utils::tree_to_utf8( $users_name ), ), ), Cheers, John From:
eprints-tech-bounces@ecs.soton.ac.uk [mailto:eprints-tech-bounces@ecs.soton.ac.uk]
On Behalf Of Vials Moore, Adam Hey all! I’m trying to send an email notification about an item using the user->mail method This uses a phrase as the subject HOWEVER I’d really like to set the eprintid and I can’t figure out a way to define it, as the method seems only to allow the phrase
as part of the call So – at the moment it looks like: my $result = $user->mail( "eprint_thesis_notify_mail_subject", $mail );
|
- References:
- [EP-tech] Adding a pin to a subject line using User->Mail
- From: "Vials Moore, Adam" <Adam.Moore@liverpool.ac.uk>
- Re: [EP-tech] Adding a pin to a subject line using User->Mail
- From: John Salter <J.Salter@leeds.ac.uk>
- Re: [EP-tech] Adding a pin to a subject line using User->Mail
- From: "Vials Moore, Adam" <Adam.Moore@liverpool.ac.uk>
- Re: [EP-tech] Adding a pin to a subject line using User->Mail
- From: John Salter <J.Salter@leeds.ac.uk>
- [EP-tech] Adding a pin to a subject line using User->Mail
- Prev by Date: Re: [EP-tech] Adding a pin to a subject line using User->Mail
- Next by Date: Re: [EP-tech] Move repository
- Previous by thread: Re: [EP-tech] Adding a pin to a subject line using User->Mail
- Next by thread: [EP-tech] Coverpage and revisions
- Index(es):