Use Send message without attachements - WeOnlyDo Discussion board

Use Send message without attachements (wodSmtp)

by nightwalker83, Thursday, August 19, 2010, 09:15 (4999 days ago)

Hi,

I can use sendmessage with attachments successfully. However, when the message doesn't contain attachments the message doesn't send.

Thanks,


Nightwalker

Re: Use Send message without attachements

by wodDamir, Thursday, August 19, 2010, 13:18 (4999 days ago) @ nightwalker83

Nightwalker,

Saying doesn't work doesn't really help. Do you receive an error? Which one?

Can you provide me with Transcript property output?

Regards,
Damba

Re: Use Send message without attachements

by nightwalker83, Friday, August 20, 2010, 01:26 (4999 days ago) @ wodDamir

Nightwalker,

Saying doesn't work doesn't really help. Do you receive an error? Which one?

Can you provide me with Transcript property output?

Regards,
Damba

I don't receive an error! However, I fixed the problem by putting the end if straight after the next statement like so:

Public Function SimpleMapiSend()
'8/8/2010
'Check for attachments.
If frmAttachments.LstFiles.ListCount <> 0 Then
For a = 0 To frmAttachments.LstFiles.ListCount - 1
Smtp.Message.attach (frmAttachments.LstFiles.List(a))
Next a
End If
With Smtp
' Add the sender
.Message.From = frmSettings.txtUsername.Text
'Add the recipent
.Message.To = frmCompose.txtTo.Text
'Add the message subject
.Message.Subject = frmCompose.txtSubject.Text
'Add the message body
.Message.Text = frmCompose.txtBody.Text
'Send the message
.SendMessage
End With
End Function

Whereas before I had the End if after the End With .