L\+W\+S\+\_\+\+V\+I\+S\+I\+B\+LE L\+W\+S\+\_\+\+E\+X\+T\+E\+RN int \hyperlink{group__smtp_ga77fc9b56a1bb39484844981ec375fc29}{lws\+\_\+email\+\_\+init} (struct \hyperlink{structlws__email}{lws\+\_\+email}$\ast$email, uv\+\_\+loop\+\_\+t $\ast$loop, int max\+\_\+content)
These apis let you communicate with a local S\+M\+TP server to send email from lws. It handles all the S\+M\+TP sequencing and protocol actions.
Your system should have postfix, sendmail or another M\+TA listening on port 25 and able to send email using the \char`\"{}mail\char`\"{} commandline app. Usually distro M\+T\+As are configured for this by default.
It runs via its own libuv events if initialized (which requires giving it a libuv loop to attach to).
It operates using three callbacks, on\+\_\+next() queries if there is a new email to send, on\+\_\+get\+\_\+body() asks for the body of the email, and on\+\_\+sent() is called after the email is successfully sent.
To use it
\begin{DoxyItemize}
\item create an \hyperlink{structlws__email}{lws\+\_\+email} struct
\item initialize data, loop, the email\+\_\+$\ast$ strings, max\+\_\+content\+\_\+size and the callbacks
When you have at least one email to send, call \hyperlink{group__smtp_ga5e535e346d92a9daf00be33abf79d4eb}{lws\+\_\+email\+\_\+check()} to schedule starting to send it.
\subsubsection[{\texorpdfstring{lwsgs\+\_\+smtp\+\_\+states}{lwsgs\_smtp\_states}}]{\setlength{\rightskip}{0pt plus 5cm}enum {\bf lwsgs\+\_\+smtp\+\_\+states}}\hypertarget{group__smtp_ga116be79bf44f9dc2a97f46e051fe4dc0}{}\label{group__smtp_ga116be79bf44f9dc2a97f46e051fe4dc0}
}]awaiting new email \index{L\+G\+S\+S\+M\+T\+P\+\_\+\+C\+O\+N\+N\+E\+C\+T\+I\+NG@{L\+G\+S\+S\+M\+T\+P\+\_\+\+C\+O\+N\+N\+E\+C\+T\+I\+NG}!Smtp@{Smtp}}\index{Smtp@{Smtp}!L\+G\+S\+S\+M\+T\+P\+\_\+\+C\+O\+N\+N\+E\+C\+T\+I\+NG@{L\+G\+S\+S\+M\+T\+P\+\_\+\+C\+O\+N\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+\+Q\+U\+IT@{L\+G\+S\+S\+M\+T\+P\+\_\+\+S\+E\+N\+T\+\_\+\+Q\+U\+IT}}\item[{\em
\hyperlink{group__smtp_ga5e535e346d92a9daf00be33abf79d4eb}{lws\+\_\+email\+\_\+check()} -\/ Request check for new email
\begin{DoxyParams}{Parameters}
{\em email}& struct \hyperlink{structlws__email}{lws\+\_\+email} context to check\\
\hline
\end{DoxyParams}
Schedules a check for new emails in 1s... call this when you have queued an email for send. \index{Smtp@{Smtp}!lws\+\_\+email\+\_\+destroy@{lws\+\_\+email\+\_\+destroy}}
\hyperlink{group__smtp_ga25298a5afc1074e13b2d5711a86432b2}{lws\+\_\+email\+\_\+destroy()} -\/ stop using the struct \hyperlink{structlws__email}{lws\+\_\+email}
\begin{DoxyParams}{Parameters}
{\em email}& the struct \hyperlink{structlws__email}{lws\+\_\+email} context\\
\hline
\end{DoxyParams}
Stop sending email using email and free allocations \index{Smtp@{Smtp}!lws\+\_\+email\+\_\+init@{lws\+\_\+email\+\_\+init}}
\subsubsection[{\texorpdfstring{lws\+\_\+email\+\_\+init(struct lws\+\_\+email $\ast$email, uv\+\_\+loop\+\_\+t $\ast$loop, int max\+\_\+content)}{lws\_email\_init(struct lws\_email *email, uv\_loop\_t *loop, int max\_content)}}]{\setlength{\rightskip}{0pt plus 5cm}L\+W\+S\+\_\+\+V\+I\+S\+I\+B\+LE L\+W\+S\+\_\+\+E\+X\+T\+E\+RN int lws\+\_\+email\+\_\+init (