OSDev.org

The Place to Start for Operating System Developers
It is currently Wed Apr 24, 2024 7:41 pm

All times are UTC - 6 hours




Post new topic Reply to topic  [ 19 posts ]  Go to page 1, 2  Next
Author Message
 Post subject: email with Visual Basic
PostPosted: Thu Dec 05, 2002 2:53 pm 
I'm making a program that should mail automaticly
but everytime i run my code i ged a dialogbox from
outlook with a warning for the user to alow this action
i don't want that is there a way to supres the dialog or a other way to mail in vb.

i saw some code ones that used winsock but that didn't
supported attachment my code chould support attachements

anyone who hase a solution let me know.


thats code i tried that gives the dialogs
------------------------------------------------------------------------
Private Sub Command1_Click()

Set myOlApp = CreateObject("Outlook.Application")
Set myItem = myOlApp.CreateItem(olMailItem)
Set myAttachments = myItem.Attachments
Set myRecipient = myItem.Recipients.Add("[email protected]")
myAttachments.Add "C:\Map1.xls", _
olByValue, 1, "Grafiek met resultaten 4e kwartaal 1996"


myItem.Send

End Sub


Top
  
 
 Post subject: Re:email with Visual Basic
PostPosted: Thu Dec 05, 2002 3:50 pm 
Well, your VB uses MAPI, and outlook uses security that askes the user if they want to e-mail that so a virus can't automaticly just email stuff. So, either you could make a program that e-mails your stuff, or make your program manuley e-mail, or you could make your program act like a virus, by supressing that dialog some how, and make Virus scanners and people think that your program is a virus.


Top
  
 
 Post subject: Re:email with Visual Basic
PostPosted: Thu Dec 05, 2002 11:45 pm 
study the I love you virus, you can do just what you want useing VBS without to much problem.


Top
  
 
 Post subject: Re:email with Visual Basic
PostPosted: Fri Dec 06, 2002 3:59 am 
im not trying to make a virus here...

my program should mail something at night when nobody is around and thats why i can't have the dialog boxes becuals nobody is there to answer them.

if you got a solution please help me then. :-\


Top
  
 
 Post subject: Re:email with Visual Basic
PostPosted: Fri Dec 06, 2002 8:15 am 
You could use WinSock to interface directly to your SMTP server.


Top
  
 
 Post subject: Re:email with Visual Basic
PostPosted: Fri Dec 06, 2002 8:19 am 
i tryed winsock but it's not very simple to attach a file i cinda hoped some of you could help me out i tryed the winsock page but they are very theoretical and only
give an example on how to code and decode the attache file. if any of you hase a good sample using winsock let me know?


Top
  
 
 Post subject: Re:email with Visual Basic
PostPosted: Fri Dec 06, 2002 1:14 pm 
WinSock won't let you send emails per se, but it will allow you to connect to your ISP's SMTP server and send an email that way. WinSock will let you send and receive raw bytes. Read the RFC for SMTP.

Alternatively, you could get an SMTP control.


Top
  
 
 Post subject: Re:email with Visual Basic
PostPosted: Fri Dec 06, 2002 5:29 pm 
Offline
Member
Member
User avatar

Joined: Fri Oct 22, 2004 11:00 pm
Posts: 1076
this msgbox is a 'feature' of outlook to stop viruses from sending. which is a big PITA at my work, since we automate lots of things and use automated emails.

i wrote my own SMTP control with the RFC's and added base64 encoding for attachments, etc. its really easy to do.

all you need is the winsock control and use tcp/ip to te smptp server.

i cant give you my control tho ;) my company owns it all. but it really is quite simple.

_________________
-- Stu --


Top
 Profile  
 
 Post subject: Re:email with Visual Basic
PostPosted: Sat Dec 07, 2002 5:28 am 
can you a least help me out then i got a function doing the mail but should i add the base64 coded file in the body part or after the body part or how should can i let the server know i want to add an attachment?


Top
  
 
 Post subject: Re:email with Visual Basic
PostPosted: Sat Dec 07, 2002 6:31 am 
Offline
Member
Member
User avatar

Joined: Fri Oct 22, 2004 11:00 pm
Posts: 1076
you need to generate a mime multipart message.

so you have

mime header 1
mime2
message
mime2end
mime3
attachment
mime3end
mime4
attachment
mime4end
mime end 1

etc
its all one big text file you send to the server

_________________
-- Stu --


Top
 Profile  
 
 Post subject: Re:email with Visual Basic
PostPosted: Sat Dec 07, 2002 8:17 am 
thanks you helped me alot i'm almost finnished with the project i'll post my functions then so for ones everybody can use them

i'll be famous ;D 8)


Top
  
 
 Post subject: Re:email with Visual Basic
PostPosted: Sat Dec 07, 2002 9:02 am 
what's up with those boundary's ?

i don't get that :'(


Top
  
 
 Post subject: Re:email with Visual Basic
PostPosted: Fri Dec 13, 2002 4:16 am 
i managed to send mail with attachment throu winsock
if your interrested mail me i had help of a friend and he asked not to put it on the net but i'm happy to help thou


Top
  
 
 Post subject: Re:email with Visual Basic
PostPosted: Sun Dec 15, 2002 4:17 pm 
Why would he not want it on the net?


Top
  
 
 Post subject: Re:email with Visual Basic
PostPosted: Mon Dec 23, 2002 3:31 pm 
becouls there is practicaly nobody who realy knows how to send attachments and if you take a look at it its' quit simple,but i respect my friend... so unless you are realy interrested in that pease of code i will not put it on the net. i'd be glad to send it to ya if you would want to take a look at it. 8)


Top
  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 19 posts ]  Go to page 1, 2  Next

All times are UTC - 6 hours


Who is online

Users browsing this forum: No registered users and 142 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group