# @spl.sink

Toolkits > com.ibm.streamsx.topology 1.15.9 > com.ibm.streamsx.topology.python > Creating SPL Operators from Python code > @spl.sink

Decorator to create a stateless SPL sink operator. If the Python function is decorated with `@spl.sink` then the operator is a sink operator, with a single input port and no output ports. For each input tuple the function is called.

A sink operator is oblivious to punctuation.

`@spl.for_each` is preferred to `@spl.sink`.

## Examples

Operator to send an e-mail for each tuple using the local SMTP server.

    import sys
    import smtplib

    # Import the SPL decorators
    from streamsx.spl import spl

    server = smtplib.SMTP('localhost')

    def spl_namespace():
        return "com.ibm.streamsx.topology.pysamples.mail"

    # Decorate this function as a sink operator
    # This means the operator will have a single
    # input port and no output ports. The SPL tuple
    # is passed in as described in spl_samples.py.
    # The function must return None, typically by
    # not having any return statement.
    @spl.sink
    def simplesendmail(from_addr, to_addrs, msg):
        "Send a simple email"
        server.sendmail(from_addr, to_addrs, msg)