This function generates HTML content for an email using data from Cristin.

CristinMail(
  unit.key,
  cristin.monthly,
  archive.host,
  subject = NULL,
  header = NULL,
  footer = NULL,
  replace.style = TRUE,
  width = 700,
  lang = "nn",
  get.ezproxy = FALSE,
  ezproxy.host = "inn.no",
  silent = FALSE
)

Arguments

unit.key

The key of the unit for which the email content is generated.

cristin.monthly

Data containing monthly information from Cristin.

archive.host

Host of the archive.

subject

The subject of the email. If not provided, it will be generated based on the data.

header

The header of the email. If not provided, it will be generated based on the data.

footer

The footer of the email. If not provided, a default footer will be used.

replace.style

Logical, indicating whether to replace styles in the generated HTML.

width

Width of the email content in pixels.

lang

Language for localization ("nb", "nn", "no", or "en"). Defaults to "nn".

get.ezproxy

Use ezproxy, Default: FALSE

ezproxy.host

ezproxy host, Default: 'inn.no'

silent

c2z is noisy, tell it to be quiet, Default: FALSE

Value

A list containing the subject and HTML body of the email.

Details

Used with `CristinMonthly` to create month-to-month bibliography in HTML format for email of selected units

Examples

# \donttest{
  # Create monthlies for unit 209.5.10.0
  example <- CristinMonthly(
    c2z::Zotero(
      id = "4827927",
      api = "RqlAmlH5l1KPghfCseAq1sQ1",
      user = FALSE
    ),
    unit.key = "209.5.10.0",
    start.date = "2023-07",
    post = TRUE,
    silent = FALSE
  )
#> Searching for collections 
#> Found 5 collections 
#> The Zotero list contains: 5 collections, 0 items, and 0 attachments 
#> Cristin query based on 1 unit from 07.2023 to 08.2023 
#> Creating new collections 
#> 
—————————————————Process: 100.00% (1/1). Elapsed time: 00:00:00—————————————————
#> Error in c2z::Zotero(zotero = zotero, collection.key = core.location,     search.collections = FALSE, item.type = "-attachment || note",     library = TRUE, silent = silent, force = TRUE, log = zotero$log): unused argument (search.collections = FALSE)

  # Create HTML email
  if (any(nrow(example$monthlies))) {
    example.mail <- CristinMail("209.5.10.0", example, "example.host")

    # Show subject
    cat(example.mail$subject)
  }
#> Error in example$monthlies: object of type 'closure' is not subsettable
# }