Emailen zonder bijlage

Status
Niet open voor verdere reacties.

kabourterplop

Gebruiker
Lid geworden
25 feb 2007
Berichten
323
Waarom wilt hij geen bijlage toevoegen?

Code:
        'Dim email
        Dim obj As New System.Net.Mail.SmtpClient
        Dim objsmtpclient As New System.Net.Mail.SmtpClient
        'Variable to store the attachments 
        Dim Attachment As System.Net.Mail.Attachment

        'Variable to create the message to send 
        Dim mailmsg As New System.Net.Mail.MailMessage

        'Assign the SMTP server 
        objsmtpclient.Host = "smtp.quicknet.nl"

        'Email onderwerp 
        mailmsg.Subject = onderwerp.Text

        'Bijlage
        Attachment = New System.Net.Mail.Attachment(file.Text)
        mailmsg.Attachments.Add(Attachment)

        'Ontvanger check
        If email.Text = "" Then
            MsgBox("U moet wel een contactpersoon selecteren!", MsgBoxStyle.Critical, "PDF-Emailer")
            Me.Close()
        Else
            'Verzenden van email 
            mailmsg = New System.Net.Mail.MailMessage("email@domein.nl", email.Text, mailmsg.Subject, bericht.Text)
            objsmtpclient.Send(mailmsg)
            MsgBox("Uw email is verzonden!", MsgBoxStyle.Information, "PDF-Emailer")
 
Zoals in het script staat geef ik de bijlage aan als mailMsg maar neemt hem niet op.

Wat gaat er fout?
 
Status
Niet open voor verdere reacties.
Terug
Bovenaan Onderaan