Open Search
    SmtpMailInterface Class Reference

    #include <network_smtpmail.h>

    Detailed Description

    Send mail via smtp.

    Public Member Functions

    MAXON_METHOD Result< void > AttachText (const String &text)
     
    MAXON_METHOD Result< void > AttachBin (const Url &fname, MEDIA media=MEDIA::UNKNOWN, MEDIASUB sub=MEDIASUB::UNKNOWN)
     
    MAXON_METHOD Result< void > AttachBin (const String &fileName, const Block< const Char > &data, MEDIA media=MEDIA::UNKNOWN, MEDIASUB sub=MEDIASUB::UNKNOWN)
     
    MAXON_METHOD Result< void > SetSender (const String &sender, const String &senderClearName)
     
    MAXON_METHOD Result< void > GetSender (String &sender, String &senderClearName) const
     
    MAXON_METHOD Result< void > SetReceiver (const Block< const SmtpReceiver > &receiver)
     
    MAXON_METHOD Result< void > GetReceiver (WritableArrayInterface< SmtpReceiver > &receiver) const
     
    MAXON_METHOD Result< void > SetSubject (const String &subject)
     
    MAXON_METHOD Result< void > GetSubject (String &subject) const
     
    MAXON_METHOD Result< void > SetUserPassword (const String &user, const String &passwd)
     
    MAXON_METHOD Result< void > GetUserPassword (String &user, String &passwd) const
     
    MAXON_METHOD Result< void > SendMimeMail (const String &hostName, Int port)
     

    Static Public Member Functions

    static MAXON_METHOD SmtpMailInterfaceAlloc (MAXON_SOURCE_LOCATION_DECLARATION)
     

    Private Member Functions

     MAXON_INTERFACE_NONVIRTUAL (SmtpMailInterface, MAXON_REFERENCE_NORMAL, "net.maxon.interface.smtpmail")
     

    Member Function Documentation

    ◆ MAXON_INTERFACE_NONVIRTUAL()

    MAXON_INTERFACE_NONVIRTUAL ( SmtpMailInterface  ,
    MAXON_REFERENCE_NORMAL  ,
    "net.maxon.interface.smtpmail"   
    )
    private

    ◆ Alloc()

    function to allocate new instances of this object. use SmtpMailRef mail(MAXON_SOURCE_LOCATION); to allocate new object. SmtpMailRef is freed automatically.

    ◆ AttachText()

    MAXON_METHOD Result<void> AttachText ( const String text)

    Set the text body of the mail.

    Parameters
    [in]textThe text of the mail body.
    Returns
    IsOk() if the function succeded. HasError() if failed.

    ◆ AttachBin() [1/2]

    MAXON_METHOD Result<void> AttachBin ( const Url fname,
    MEDIA  media = MEDIA::UNKNOWN,
    MEDIASUB  sub = MEDIASUB::UNKNOWN 
    )

    Attach an binary file.

    Parameters
    [in]fnameThe Url of the attachment. Set the right mode so that the mail gets the right type.
    [in]mediaSee MEDIA.
    [in]subSee MEDIASUB.
    Returns
    IsOk() if the function succeded. HasError() if failed.

    ◆ AttachBin() [2/2]

    MAXON_METHOD Result<void> AttachBin ( const String fileName,
    const Block< const Char > &  data,
    MEDIA  media = MEDIA::UNKNOWN,
    MEDIASUB  sub = MEDIASUB::UNKNOWN 
    )

    Attach an binary file.

    Parameters
    [in]fileNameFile name of the attachment.
    [in]dataBinary data to attach.
    [in]mediaSee MEDIA.
    [in]subSee MEDIASUB.
    Returns
    IsOk() if the function succeded. HasError() if failed.

    ◆ SetSender()

    MAXON_METHOD Result<void> SetSender ( const String sender,
    const String senderClearName 
    )

    Set the sender email address and name.

    Parameters
    [in]senderEmail address of the sender.
    [in]senderClearNameReal name of the sender.
    Returns
    IsOk() if the function succeded. HasError() if failed.

    ◆ GetSender()

    MAXON_METHOD Result<void> GetSender ( String sender,
    String senderClearName 
    ) const

    Get the sender email address and name.

    Parameters
    [out]senderRetrieves the email address of the sender.
    [out]senderClearNameRetrieves the real name of the sender.
    Returns
    IsOk() if the function succeded. HasError() if failed.

    ◆ SetReceiver()

    MAXON_METHOD Result<void> SetReceiver ( const Block< const SmtpReceiver > &  receiver)

    Set the receiver email address and name.

    Parameters
    [in]receiverEmail addresses of the receivers.
    Returns
    IsOk() if the function succeded. HasError() if failed.

    ◆ GetReceiver()

    MAXON_METHOD Result<void> GetReceiver ( WritableArrayInterface< SmtpReceiver > &  receiver) const

    Get the receiver email address and name.

    Parameters
    [out]receiverRetrieves the email address of the receiver.
    Returns
    IsOk() if the function succeded. HasError() if failed.

    ◆ SetSubject()

    MAXON_METHOD Result<void> SetSubject ( const String subject)

    Set the subject of the mail.

    Parameters
    [in]subjectMail subject.
    Returns
    IsOk() if the function succeded. HasError() if failed.

    ◆ GetSubject()

    MAXON_METHOD Result<void> GetSubject ( String subject) const

    Get the subject of the mail.

    Parameters
    [out]subjectRetrieves the email subject.
    Returns
    IsOk() if the function succeded. HasError() if failed.

    ◆ SetUserPassword()

    MAXON_METHOD Result<void> SetUserPassword ( const String user,
    const String passwd 
    )

    Sets the login user name and password for the smtp server.

    Parameters
    [in]userUsername to logon at the smtp server.
    [in]passwdPassword to logon at the smtp server.
    Returns
    IsOk() if the function succeded. HasError() if failed.

    ◆ GetUserPassword()

    MAXON_METHOD Result<void> GetUserPassword ( String user,
    String passwd 
    ) const

    Gets the login user name and password for the smtp server.

    Parameters
    [out]userRetrieves username to logon at the smtp server.
    [out]passwdRetrieves to logon at the smtp server.
    Returns
    IsOk() if the function succeded. HasError() if failed.

    ◆ SendMimeMail()

    MAXON_METHOD Result<void> SendMimeMail ( const String hostName,
    Int  port 
    )

    Start the process of sending the mail.

    Parameters
    [in]hostNameSmtp server address or name.
    [in]portSmtp server port.
    Returns
    IsOk() if the function succeded. HasError() if failed.