I am using the Mailgun Java API which is used to send emails. There is a .to
method on a message builder that you use to populate the recipient's details. However, when I try to use this it tells me that there is a compilation error as it assumes I am trying to use the .to
function that creates a pair.
I started with:
Message.builder()
.from(emailAddress)
.subject(subject)
.attachment(File("/path/to/file"))
.to(recipient)
.build()
It tells me .build()
is an Unresolved Reference and when I hover over .to
it shows
public infix fun <A, B> A.to(
that: B
): Pair<A, B>
as the function it is using. I tried to specify .`to`(recipient)
in order to try to get around this and tried to see if I could import the method but this is not possible and I removed this as it tells me
Cannot import 'to', functions and properties can be imported only from packages or objects
I also tried creating an extension function but it can't access the private to
property of the MessageBuilder so this doesn't seem possible.