Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Sending Email via SMTP
Message
From
11/11/2003 12:46:22
Jim Rieck
Quicken Loans/Rock Financial/Title Sourc
Livonia, Michigan, United States
 
General information
Forum:
ASP.NET
Category:
Other
Miscellaneous
Thread ID:
00848475
Message ID:
00848793
Views:
30
Hi Mark,

Thanks for your suggestion, I will try it. I wanted to know what CDONTS.NewMail is?

Jim

>Jim,
>try this, it may need a little modifing but it works in asp perfectly for me and i didn't have to alter the smtp settings at all. i am using 2k a-server and iis.
>
>' SEND EMAIL
>'
>adm_to = "to@kernel.ie"
>adm_from = "from@kernel.ie"
>adm_subject = "trial subject for test email"
>adm_body = "any old text just to fill in space"
>
>Set objCDOMail = Server.CreateObject("CDONTS.NewMail")
>
>objCDOMail.To = adm_to
>objCDOMail.From = adm_from
>objCDOMail.Subject = adm_subject
>objCDOMail.Body = adm_body
>
>
>' CANT VOUCH FOR THIS PART BUT IT IS SUPPOSED TO WORK, I DONT
>' SEND ATTACHMENTS.
>'
>lcFileName =GETFILE('','','',0,'Select the file to add in the email')
>' Add attachment to the email object: AddFileAttachment(fileName As String) As String
>objCDOMail.AddFileAttachment( lcFileName )
>
>
>' Send the message!
>objCDOMail.Send
>
>' END SEND EMAIL
>'
>
>Slán
>~M
>
>
>
>>All,
>>
>> I have a website that sends vistors email via SMTP. The SMTP service is running on the server, but I am getting an error message when I call the send command of the smtp object. The error message is: "Could not access 'CDO.Message' object". My code is below,
>>
>>IMPORTS System.web.mail
>>.....
>>Private Sub SendEmail()
>> Dim oMsg As New MailMessage()
>> Dim strFile1 As String
>> Dim strFile2 As String
>>
>> strFile1 = Server.MapPath("mydoc.doc")
>> strFile2 = Server.MapPath("mydoc2.doc")
>> Dim oAttchmnt1 As MailAttachment = New MailAttachment(strFile1, MailEncoding.Base64)
>> Dim oAttchment2 As MailAttachment = New MailAttachment(strFile2, MailEncoding.Base64)
>>
>> With oMsg
>> .From = "JimRieck@yahoo.com"
>> .To = txtEmail.Text
>> .Subject = ""
>> .BodyFormat = MailFormat.Text
>> .Attachments.Add(oAttchmnt1)
>> .Attachments.Add(oAttchmnt2)
>> End With
>> SmtpMail.SmtpServer = "localhost"
>> SmtpMail.Send(oMsg)
>>End Sub
Thanks

Jim
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform