knet_init();
KMail mail = mail_Create( 0, NULL, 0 );
mail_SetSMTP( mail, HOST, PORT );
mail_SetLogin( mail, USER );
mail_SetPassword( mail, PASSWORD );
mail_SetLogin( mail, USER );
KMsg msg = msg_Create();
msg_AddTo( msg, TO );
msg_SetFrom( msg, USER );
msg_SetSubject( msg, "Тема" );
msg_AddDefTextPart( msg, "Текст", "plain" );
msg_AttachFile( msg, "/tmp/5.png", NULL );
if( !mail_OpenSession( mail, 1, AUTH_LOGIN ) )
{
printf( "[%s]\n", mail_GetError( mail ) );
}
else
{
if( !mail_SendMessage( mail, msg ) )
{
printf( "<%s>\n", mail_GetError( mail ) );
}
mail_CloseSession( mail );
}
msg_Destroy( msg );
mail_Destroy( mail );
knet_down();
klopp/ksmtp
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
About
Small SMTP library
Resources
License
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published