Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Form to email to via smtp (hotmail).

Status
Not open for further replies.

Moss100

Technical User
Aug 10, 2004
579
0
16
GB
Hello I want to create a form to email text and attachements via hotmail.

I have had some success with a sample form, but it seems unrelaible.

Can anyone give me code or a sample for to help me with this?

many thanks mark
 
I'd use CDO:
thread705-1369407

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Hello - I have got the code below to work - but i would like to add an attachement (the attachement path is storred in a textbox called txtattachement on the form)

How would I add this??? Thank you Mark


Private Sub Command0_DblClick(Cancel As Integer)
Dim iMsg As Object
Dim iConf As Object
Dim Flds As Variant
Set iMsg = CreateObject("CDO.Message")
Set iConf = CreateObject("CDO.Configuration")
iConf.Load -1 ' CDO Source Defaults
Set Flds = iConf.Fields
With Flds
.Item(" = 1
.Item(" = "test50@hotmail.com"
.Item(" = "testpassword"
.Item(" = "smtp.live.com"
.Item(" = 2
.Item(" = 25 'OR 587
'Use SSL for the connection (False or True)
.Item(" = True
.Update
End With

With iMsg
Set .Configuration = iConf
.To = Me.txtTo
.CC = Me.Txtcc
.BCC = Me.Txtbcc
.From = "test50@hotmail.com"
.Subject = Me.TxtSubject
.TextBody = Me.TxtMessage


.Send
End With
End Sub
 
Use the iMsg.AddAttachment method.

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
OK so i have added that in below - thank you. It works fine with a text file, but with a jpg i get the error message - 'the transport lost its connection with the server'.

This was the problem i was coming across with the original form. Any ideas??



Private Sub Command0_DblClick(Cancel As Integer)
Dim iMsg As Object
Dim iConf As Object
Dim Flds As Variant
Set iMsg = CreateObject("CDO.Message")
Set iConf = CreateObject("CDO.Configuration")
iConf.Load -1 ' CDO Source Defaults
Set Flds = iConf.Fields
With Flds
.Item(" = 1
.Item(" = "test50@hotmail.com"
.Item(" = "testpassword"
.Item(" = "smtp.live.com"
.Item(" = 2
.Item(" = 25 'OR 587
'Use SSL for the connection (False or True)
.Item(" = True
.Update
End With

With iMsg
Set .Configuration = iConf
.To = Me.txtTo
.CC = Me.Txtcc
.BCC = Me.Txtbcc
.From = "test50@hotmail.com"
.Subject = Me.TxtSubject
.TextBody = Me.TxtMessage
.AddAttachment "c:\amy.jpg"

.Send
End With
End Sub
 
The problem seems to only occur with attachments.

Attachments often cause a error message (even when they are hard coded in - i.e c:\image1.jpg)

Also attachements appear as only only a grey icon on the iphone (receining thorugh a hotmail account) - when clicked the screen then just leads to a grey screen.

So really it seems to be attachments (esp photos) that are causing the problem.

Thanks Mark
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top