how to send e mail from a desktop application

By ramannambudiripad ·
we have developed a software which will send personalised newsletter to all our customers at scheduled time. It is a desktop application in currently we are using mapi control and outlook express to send mail. Now i want to send this in html format please help me.
outlook express is not supporting html content
smtp mail is not working because of authentication failure
Outlook warning interrupts automated emailing

pl help me

raman nambudiripad

codes given below
Private Sub SendMailMapi(byval toaddrs as string,byval subj as string, byval msg as string,byval filename as string )
Dim mps As New MSMAPI.MAPISession
Dim mpm As New MSMAPI.MAPIMessages
mps.NewSession = True
mpm.SessionID = mps.SessionID
mpm.RecipAddress = toaddrs
mpm.AddressResolveUI = True
mpm.MsgSubject = subj
mpm.MsgNoteText = msg
mpm.AttachmentName = FilesName
mpm.MsgType = 2
mpm.AttachmentPathName = FilesName
mpm.AttachmentType = 2

End Sub
Private Sub SmtpMail(byval toddrs as string,byval subj as string, byval msg as string,byval filename as string)
Dim arlAttachments As ArrayList
arlAttachments = New ArrayList()
arlAttachments.Add(New Attachment(FilesName))
Dim mailMsg As New MailMessage("", toaddrs)
With mailMsg
.CC.Add(New MailAddress(""))

.Subject = subj
.Body = msg
.IsBodyHtml = True
If Not IsNothing(arlAttachments) Then
Dim mailAttachment As Attachment
For Each mailAttachment In arlAttachments
End If
End With
' attempt.
Dim SmtpMail As New SmtpClient("")
SmtpMail.EnableSsl = True
SmtpMail.Port = 25
SmtpMail.UseDefaultCredentials = False
SmtpMail.Credentials = New Net.NetworkCredential("", "mypass")
SmtpMail.Timeout = 50
SmtpMail.DeliveryMethod = SmtpDeliveryMethod.Network


MessageBox.Show("Your email has been successfully sent!", _
"Email Send Status", MessageBoxButtons.OK, _
Catch exp As Exception
MessageBox.Show("The following problem occurred when attempting to " & _
"send your email: " & exp.Message, _
Me.Text, MessageBoxButtons.OK, MessageBoxIcon.Error)
End Try
Exit Sub
End Sub
Private Sub OutlookpMail(byval toddrs as string,byval subj as string, byval msg as string,byval filename as string)

Dim olApp As Outlook.Application
Set olApp = CreateObject("Outlook.Application")
Dim olNs As Outlook.NameSpace
Set olNs = olApp.GetNamespace("MAPI")
Dim olMail As Outlook.MailItem
Set olMail = olApp.CreateItem(olMailItem)
olMail.To = toaddrs
olMail.Subject = subj
olMail.Body = msg
Set olNs = Nothing
Set olMail = Nothing
Set olApp = Nothing
end sub

This conversation is currently closed to new comments.

Thread display: Collapse - | Expand +

All Answers

Share your knowledge

Related Discussions

Related Forums