PDA

Click to See Complete Forum and Search --> : [RESOLVED] how send email in vb


12345
Dec 30th, 2005, 06:40 AM
hello everybody

how can i send an email without outlook?

there is some code?
i've seen the other thread but i didn't find what i'm looking for.

Hack
Dec 30th, 2005, 08:00 AM
This will use whatever the default mail client is.Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" _
(ByVal hWnd As Long, ByVal lpOperation As String, ByVal lpFile As String, _
ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long

Private Const SW_SHOWNORMAL = 1

Private Sub Command1_Click()
Dim MailMe As String
MailMe = "mailto: bonnhedger@weggieworld.com"
ShellExecute Me.hWnd, "open", MailMe, vbNullString, vbNullString, SW_SHOWNORMAL
End Sub

12345
Dec 30th, 2005, 08:14 AM
but this code send an email via browser
i want to send an email directly from vb

for ex.:
____________
| Send email |
on click

from="pluto@pluto.com"
to="pippo@pippo.com"
object="ciao"
msg="ciao"

Hack
Dec 30th, 2005, 10:27 AM
but this code send an email via browser
i want to send an email directly from vb

for ex.:
____________
| Send email |
on click

from="pluto@pluto.com"
to="pippo@pippo.com"
object="ciao"
msg="ciao"Browser :confused: What do you mean? If I run that code from a VB program, it opens and creates a new mail message based on what my default mail program is. It is nothing to do with a browser.

12345
Dec 30th, 2005, 10:33 AM
for browser, i mean internet explorer
that code open a new window of internet explorer
and then i can write a mail

instead i want to do a program
that allow to write sender, recipient, object, body
and then send the email

Hack
Dec 30th, 2005, 10:44 AM
for browser, i mean internet explorer
that code open a new window of internet explorer
and then i can write a mailNot on any machine I've tried it on.

I have access machines on which the default mail is standard Outlook and other machines on which the default mail is Lotus Notes. When I run that code, it opens whatever the machines default mail package is. Is does nothing with IE.

What is the default mail program on your machine?

12345
Dec 30th, 2005, 10:47 AM
my default is Hotmail. But i don't want to do in this way.

i've seen a thread where there was a program: fake mailer
but it doesn't work

i want to do a program similar to that one

Hack
Dec 30th, 2005, 10:52 AM
my default is Hotmail.Oh....that is why it opens IE on your machine.i've seen a thread where there was a program: fake mailer but it doesn't work.

i want to do a program similar to that oneYou want to write your own email program?

12345
Dec 30th, 2005, 10:56 AM
yes.

i've found 2 components: MAPImessages, MAPIsession

i want to know if those one work also without outlook.


excuse my english, i'm italian

12345
Dec 30th, 2005, 11:10 AM
i've tryed mapi component

but when i send email
since i use hotmail, it ask to type username and password
so i must create a new session?

Hack
Dec 30th, 2005, 11:19 AM
i've tryed mapi component

but when i send email
since i use hotmail, it ask to type username and password
so i must create a new session?Yes. When using any password protecting email system, you would have to supply the necessary credentials.

BTW: MAPI is a Microsoft protocol (the M stands for Microsoft), so in all likelyhood, it would be tied to Outlook. (I say "in all likelyhood" because I've never attempted to write my own email system before, so I could be wrong, but I don't think so.)

dglienna
Dec 30th, 2005, 02:05 PM
Try this. Make sure you read the text file, if you have a dsl system.

http://vbforums.com/attachment.php?attachmentid=39531

193 people have downloaded version 2, so you can bet that it works. Hotmail may prevent you from relaying the mail off of your server, though. If you have a high speed connection, use their mail instead.

12345
Dec 31st, 2005, 08:38 AM
anyone know a smtp server address that work?

else i can't try the program

Aries Mars
Jan 5th, 2006, 01:47 AM
How do you specify a subject, message etc.. using the winAPI method?

dglienna
Jan 5th, 2006, 04:28 PM
anyone know a smtp server address that work?

else i can't try the program

Did you read the text file that I included? Some ISP's require you to use your real user name when sending email. You can use any smtp server, as long as you use your user name. I tried that code again, and it worked fine for me.

Aries Mars
Jan 7th, 2006, 09:58 PM
I meant the api method by Hack. Its the second reply...