[vb6] Email verzenden

Pagina: 1
Acties:

  • TweakersOnly
  • Registratie: September 2000
  • Laatst online: 00:43
Ik heb een vb6 programma gemaakt die diverse bestanden uitleest en afhankelijk van de resultaten een email moet versturen. Oorspronkelijk had ik ervoor gekozen om dit via de Outlook reference te doen icm MAPI. Dit werkte goed, onder het standaard outlook account op de machine kon ik een email naar een willekeurig persoon versturen.

Echter, het programma gaat binnenkort draaien op een Win2000 server waarop geen outlook is geinstalleerd. Zodoende zal mijn code natuurlijk niet meer werken. Weet iemand hoe ik in de nieuwe stuatie alsnog een email kan verzenden, ook met attachments en hoge prioriteit?

  • muba
  • Registratie: April 2002
  • Laatst online: 19-10-2013

muba

Prince of Persia!

Reporter: Mister Gandhi, what do you think of western civilisation?
Gandhi: I think it would be a good idea


Verwijderd

gebruik dit gratis component: http://www.aspemail.com/

  • KO
  • Registratie: December 2001
  • Laatst online: 12-11-2023

KO

Yesterday Is History. Today Is A Gift. Tomorrow Is Mystery


Verwijderd

of je schrijft met winsock zelf wat dat met een smtp-server mail kan sturen.

hier de SMTP rfc
hier een simpel voorbeeld
en je kunt veel voorbeelden vinden op Planet SourceCode

[ Voor 6% gewijzigd door Verwijderd op 19-07-2003 11:50 ]


Verwijderd

Onder IIS van Win2000 zit een SMTP server. Als je die aanzet, kan je met CDO email versturen. De 'hoge prioriteit' is volgens mij een niet-standaard SMTP toevoeging, dus dan zal je even bij MS moeten zoeken naar hoe dat werkt.

Succes :)

  • RobIII
  • Registratie: December 2001
  • Niet online

RobIII

Admin Devschuur®

^ Romeinse Ⅲ ja!

(overleden)
Ook gratis, en werkt nog fatsoenlijk en lekker makkelijk ook: Dundas componenten. Geen accounts nodig etc, gebruikt willekeurig welke SMTP server en kan prioriteiten, html-mail en attachments etc. gebruiken. Echt de moeite waard om eens te bekijken.

...en je hoeft geen enorme zooi bagger te installeren (is vaak wel zo) want de download is 334kb, de handleiding kun je integreren in MSDN en is goed leesbaar en duidelijk.

Directe URL: Dundas mailer
Features:
• Choose between text and/or html-based email.
• Fully supports embedded html objects within an html-based email (audio files, graphics files, etc.).
• Ability to post news articles to news groups. You have the option of posting to the root directory or as a response to a particular article.
• Specify multiple recipients by using the TOs, CCs, and BCCs collections.
• Message headers and the message body can be set to non-ASCII values.
• Validate your email addresses to save your bandwidth.
• Specify multiple SMTP and DNS servers to make your email operations lightning quick.
• Fully supports the use of custom headers.
• Optionally prioritizes your messages. You can also request confirmation when the user retrieves and/or reads an email message.
• Send multiple attachments with your messages.
• MSDN integrated html help.

Stukjes voorbeeldcode (is asp, maar makkelijk en bijna gelijk aan VB6):
ASP:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
<%
'most control methods throw an exception if an error occurs so we will use an On Error statement
On Error Resume Next 

Dim objMailer 'Mailer control 

'create instance of Mailer control
Set objMailer = Server.CreateObject("Dundas.Mailer")

'send email
objMailer.QuickSend "FromMe@SomeServer.com","ToSomeUser@SomeDomain.com","Subject","This is the body."
'you can test for the success/failure of the operation by examining VBScript's Err object here

Set objMailer = Nothing
%>

ASP:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
Sending an Email with the SendMail Method
<%
'most control methods throw an exception if an error occurs so we will use an On Error statement
On Error Resume Next

Dim objMailer 'Mailer control

'create instance of Mailer control
Set objMailer = Server.CreateObject("Dundas.Mailer")

'set Mailer control properties and collection items
objMailer.TOs.Add "martine@dundas.com"
objMailer.FromAddress = "FromMe@SomeServer.com"
objMailer.Subject = "Subject"
objMailer.Body = "This is the body."

'send email
objMailer.SendMail
'you can test for the success/failure of the operation by examining VBScript's Err object here

Set objMailer = Nothing
%>

[ Voor 137% gewijzigd door RobIII op 19-07-2003 12:01 ]

There are only two hard problems in distributed systems: 2. Exactly-once delivery 1. Guaranteed order of messages 2. Exactly-once delivery.

Je eigen tweaker.me redirect

Over mij

Pagina: 1