summaryrefslogtreecommitdiffabout
path: root/kmicromail
Side-by-side diff
Diffstat (limited to 'kmicromail') (more/less context) (ignore whitespace changes)
-rw-r--r--kmicromail/composemail.cpp14
-rw-r--r--kmicromail/libmailwrapper/smtpwrapper.cpp23
-rw-r--r--kmicromail/libmailwrapper/smtpwrapper.h4
3 files changed, 25 insertions, 16 deletions
diff --git a/kmicromail/composemail.cpp b/kmicromail/composemail.cpp
index 2c2e279..ca4f247 100644
--- a/kmicromail/composemail.cpp
+++ b/kmicromail/composemail.cpp
@@ -121,7 +121,7 @@ void ComposeMail::saveAsDraft()
AttachViewItem *it = (AttachViewItem *) attList->firstChild();
/* attachments we will ignore! */
- if ( it != NULL ) {
+ if ( it != 0 ) {
if ( warnAttach )
QMessageBox::warning(0,tr("Store message"),
tr("<center>Attachments will not be stored in \"Draft\" folder</center>"));
@@ -136,7 +136,7 @@ void ComposeMail::clearStatus()
void ComposeMail::setStatus( QString status )
{
topLevelWidget()->setCaption( status );
- QTimer::singleShot ( 5000, this, SLOT( clearStatus() ) ) ;
+ QTimer::singleShot ( 10000, this, SLOT( clearStatus() ) ) ;
}
void ComposeMail::pickAddress( QLineEdit *line )
{
@@ -300,13 +300,19 @@ void ComposeMail::accept()
}
mail->setMessage( txt );
AttachViewItem *it = (AttachViewItem *) attList->firstChild();
- while ( it != NULL ) {
+ while ( it != 0 ) {
mail->addAttachment( it->getAttachment() );
it = (AttachViewItem *) it->nextSibling();
}
SMTPwrapper wrapper( smtp );
- wrapper.sendMail( mail,checkBoxLater->isChecked() );
+ if ( wrapper.sendMail( mail,checkBoxLater->isChecked() ) )
+ setStatus( tr ("Mail sent"));
+ else {
+ setStatus( tr ("Error: Something went wrong. Nothing sent"));
+ return;
+ }
+
QDialog::accept();
}
diff --git a/kmicromail/libmailwrapper/smtpwrapper.cpp b/kmicromail/libmailwrapper/smtpwrapper.cpp
index 04a21ea..6a1b505 100644
--- a/kmicromail/libmailwrapper/smtpwrapper.cpp
+++ b/kmicromail/libmailwrapper/smtpwrapper.cpp
@@ -102,7 +102,7 @@ void SMTPwrapper::storeMail(const char*mail, size_t length, const QString&box) {
delete wrap;
}
-void SMTPwrapper::smtpSend( mailmime *mail,bool later) {
+bool SMTPwrapper::smtpSend( mailmime *mail,bool later) {
clist *rcpts = 0;
char *from, *data;
size_t size;
@@ -118,8 +118,8 @@ void SMTPwrapper::smtpSend( mailmime *mail,bool later) {
if (r != MAIL_NO_ERROR || !data) {
if (data)
free(data);
- ; // odebug << "Error fetching mime..." << oendl;
- return;
+ qDebug("Error fetching mime... ");
+ return false;
}
msg = 0;
if (later) {
@@ -130,11 +130,11 @@ void SMTPwrapper::smtpSend( mailmime *mail,bool later) {
cfg.setGroup( "Status" );
cfg.writeEntry( "outgoing", ++m_queuedMail );
emit queuedMails( m_queuedMail );
- return;
+ return true;
}
from = getFrom( mail );
rcpts = createRcptList( mail->mm_data.mm_message.mm_fields );
- smtpSend(from,rcpts,data,size);
+ bool result = smtpSend(from,rcpts,data,size);
if (data) {
free(data);
}
@@ -143,6 +143,7 @@ void SMTPwrapper::smtpSend( mailmime *mail,bool later) {
}
if (rcpts)
smtp_address_list_free( rcpts );
+ return result;
}
void SMTPwrapper::storeFailedMail(const char*data,unsigned int size, const char*failuremessage)
@@ -316,24 +317,26 @@ int SMTPwrapper::smtpSend(char*from,clist*rcpts,const char*data,size_t size )
return result;
}
-void SMTPwrapper::sendMail(const Opie::Core::OSmartPointer<Mail>&mail,bool later )
+bool SMTPwrapper::sendMail(const Opie::Core::OSmartPointer<Mail>&mail,bool later )
{
mailmime * mimeMail;
-
+ bool result = true;
mimeMail = createMimeMail(mail );
- if ( mimeMail == NULL ) {
- ; // odebug << "sendMail: error creating mime mail" << oendl;
+ if ( mimeMail == 0 ) {
+ qDebug("SMTP wrapper:Error creating mail! ");
+ return false;
} else {
sendProgress = new progressMailSend();
sendProgress->show();
sendProgress->setMaxMails(1);
- smtpSend( mimeMail,later);
+ result = smtpSend( mimeMail,later);
; // odebug << "Clean up done" << oendl;
sendProgress->hide();
delete sendProgress;
sendProgress = 0;
mailmime_free( mimeMail );
}
+ return result;
}
int SMTPwrapper::sendQueuedMail(AbstractMail*wrap,const RecMailP&which) {
diff --git a/kmicromail/libmailwrapper/smtpwrapper.h b/kmicromail/libmailwrapper/smtpwrapper.h
index 6c5bbe8..105cbf5 100644
--- a/kmicromail/libmailwrapper/smtpwrapper.h
+++ b/kmicromail/libmailwrapper/smtpwrapper.h
@@ -23,7 +23,7 @@ class SMTPwrapper : public Generatemail
public:
SMTPwrapper(SMTPaccount * aSmtp);
virtual ~SMTPwrapper();
- void sendMail(const Opie::Core::OSmartPointer<Mail>& mail,bool later=false );
+ bool sendMail(const Opie::Core::OSmartPointer<Mail>& mail,bool later=false );
bool flushOutbox();
static progressMailSend*sendProgress;
@@ -40,7 +40,7 @@ protected:
int start_smtp_tls();
- void smtpSend( mailmime *mail,bool later);
+ bool smtpSend( mailmime *mail,bool later);
static void storeMail(const char*mail, size_t length, const QString&box);
static QString mailsmtpError( int err );