473,507 Members | 3,678 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to smtp email?

OK, I am getting really frustrated with this. I need to be able to send email
using smtp. The server that we are using is hosted by a third party. We have
created a new account with username and password.

I have searched high and low for a solution to my problem. I have
implemented what I have found but I still get the same error:

"System.Web.HttpException: Could not access 'CDO.Message' object. --->
System.Reflection.TargetInvocationException: Exception has been thrown by the
target of an invocation. ---System.Runtime.InteropServices.COMException
(0x80040220): The "SendUsing" configuration value is invalid.

--- End of inner exception stack trace ---

at System.RuntimeType.InvokeDispMethod(String name, BindingFlags invokeAttr,
Object target, Object[] args, Boolean[] byrefModifiers, Int32 culture,
String[] namedParameters)

at System.RuntimeType.InvokeMember(String name, BindingFlags invokeAttr,
Binder binder, Object target, Object[] args, ParameterModifier[] modifiers,
CultureInfo culture, String[] namedParameters)

at System.Type.InvokeMember(String name, BindingFlags invokeAttr, Binder
binder, Object target, Object[] args)

at System.Web.Mail.LateBoundAccessHelper.CallMethod(T ype type, Object obj,
String methodName, Object[] args)

at System.Web.Mail.LateBoundAccessHelper.CallMethod(O bject obj, String
methodName, Object[] args)

--- End of inner exception stack trace ---

at System.Web.Mail.LateBoundAccessHelper.CallMethod(O bject obj, String
methodName, Object[] args)

at System.Web.Mail.CdoSysHelper.Send(MailMessage message)

at System.Web.Mail.SmtpMail.Send(MailMessage message)

at TheColeGroup.Mail.btnSend_Click(Object sender, EventArgs e) in
D:\Projects\Cole Group\TheColeGroupWeb\Mail.aspx.vb:line 106"

Here is the code that I am using:

<code>

Private Sub btnSend_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnSend.Click
Dim objMail As New MailMessage
lSuccess =

False

Try

If System.IO.File.Exists(Me.txtAttachment.Text) Then
objMail.To =

Me.txtTo.Text
objMail.From = "re*****@thecolegroup.com;" &

Me.txtFrom.Text
objMail.Cc =

Me.txtCC.Text
objMail.BodyFormat = MailFormat.Text

objMail.Subject =

Me.txtSubject.Text
objMail.Body =

Me.txtBody.Text
objMail.Attachments.Add(

New MailAttachment(Me.txtAttachment.Text, MailEncoding.Base64))
objMail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate", "1")

'basic authentication
objMail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusername", "username")

'set your username here
objMail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendpassword", "password")

'set your password here
SmtpMail.SmtpServer.Insert(0, "smtp.mysite.com")

'SmtpMail.SmtpServer.Insert(0, "smtp_auth.mysite.com")

SmtpMail.Send(objMail)

lSuccess =

True

End If

Catch ex As Exception
sMessage = ex.ToString
End Try
End Sub</code>

Can anyone please HELP ME!?

Thanks,

enak

--
enak
Jul 2 '06 #1
3 1309
"enak" <en**@discussions.microsoft.comwrote in message
news:F6**********************************@microsof t.com...
Can anyone please HELP ME!?
http://www.systemwebmail.com
Jul 2 '06 #2
Thanks, but I have already seen that. Is there a setting that I need to set
or do I need to contact the email provider? What is the problem?
--
enak
"Mark Rae" wrote:
"enak" <en**@discussions.microsoft.comwrote in message
news:F6**********************************@microsof t.com...
Can anyone please HELP ME!?

http://www.systemwebmail.com
Jul 2 '06 #3
all you need it to add the HOST and for some hosting companies you need also
to set the Credentials of an account (user, password) so they can prevent
spam!

do that using this:

Private mailHost As String = "YOUR MAIL HOST"

Private mailCredentials As New Net.NetworkCredential("YOUR USERNAME", "YOUR
PASSWORD")

'create the mail message

Dim mail As New MailMessage()

'set the addresses

mail.From = New MailAddress("YOUR EMAIL", "YOUR NAME")

mail.To.Add(mailTo)

'set the content

mail.Subject = mailSubject

'screen scrape the html

Dim html As String = yourHTMLBody

mail.Body = html

mail.IsBodyHtml = True

'send the message

Dim smtp As New SmtpClient

smtp.Host = mailHost

smtp.Credentials = mailCredentials

Try

smtp.Send(mail)

Catch ex As Exception

Dim ex2 As Exception = ex

Dim errorMessage As String = String.Empty

While Not (ex2 Is Nothing)

errorMessage += ex2.ToString()

ex2 = ex2.InnerException

End While

_error = errorMessage

End Try
my _error variable is a private property under a class as string... so
change it to what you need.

--

Bruno Alexandre
(a Portuguese in Københanv, Danmark)
"enak" <en**@discussions.microsoft.comescreveu na mensagem
news:03**********************************@microsof t.com...
Thanks, but I have already seen that. Is there a setting that I need to
set
or do I need to contact the email provider? What is the problem?
--
enak
"Mark Rae" wrote:
>"enak" <en**@discussions.microsoft.comwrote in message
news:F6**********************************@microso ft.com...
Can anyone please HELP ME!?

http://www.systemwebmail.com

Jul 3 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
13850
by: Andy Turner | last post by:
Hi, I'm trying to setup PHP so it will use a remote SMTP server. I'm going to sound like a newbie but how? I know you need to alter php.ini, change SMTP from localhost to the SMTP server and the...
2
2797
by: Dan Boyle | last post by:
Hi, I am having difficulty connection to an smtp host. I am using the following code but I don't think I fully understand what smtp host can be used. function setSMTPParams($host = null,...
2
13692
by: RandRace | last post by:
I'm having some problems with a little script i wrote using net::smtp. I originally wrote it in linux where it works perfectly. I tried to use it from windows the other day and it doesn't work. It...
3
5544
by: dale zhang | last post by:
Hi, I write an asp.net web application. It has a “Contact Us” page, where users fill in their email, subject and text and hit send. Then the email will go to my hard coded yahoo email...
1
2122
by: Brian Bischof | last post by:
In my Win app I found that using the SMTP object doesn't release resources after closing the application. During testing I have to open and close the app many times and I found that after about three...
34
18140
by: antonyliu2002 | last post by:
I've set up the virtual smtp server on my IIS 5.1 like so: 1. Assign IP address to "All Unassigned", and listen to port 25. 2. Access Connection granted to "127.0.0.1". 3. Relay only allow...
6
2090
by: John Salerno | last post by:
If I want to write a cgi script that reads the contents of an HTML form and emails it to me, what would I use as the host parameter for my SMTP instance? The example in the docs is 'localhost', but...
7
7719
by: oopsbabies | last post by:
Hello everyone, I am using Apache 1.3.33 as the web server and PHP version 4.3.10. My machine is using Windows XP 2002 professional edition which comes with a Windows firewall. I am using McAfee...
2
12139
by: =?Utf-8?B?QWRl?= | last post by:
HI All, I am encountering the following error when I try to send an email through a SMTP server. I believe the problem lies with the authentication part when the network crednetials are used,...
5
5285
by: jimhill10 | last post by:
I have a perl script that creates an email attachment file from POST data on a web page. This works just fine. I want to customize the email body to contain all of the text data from the file...
0
7110
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7314
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7372
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
7482
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5623
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5041
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3191
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1540
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
411
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.