Transport failed to connect to server (Full Version)

All Forums >> [Web Development] >> Server Issues



Message


pratyusha -> Transport failed to connect to server (9/24/2008 18:24:03)

Hi,

I am tring to fix a bug in my website. When the user clicks to register to an event on the calendar after filling a form ...i get this error
CDO.Message.1 error '80040213'

The transport failed to connect to the server.

C:\INETPUB\WWWROOT\CALENDAR\../includes/inc_sendmail.asp, line 120

This works fine in the live site but it doesnt work in the staging site(localhost)

This is the code:

function SendMail(fromname,fromemail,toemail,subject,body,htmlbody)
Dim message

' The form
message = body

' Email-Script
on error resume next
Select case emailtype
case "ASPmail"
Set objNewMail = Server.CreateObject("SMTPsvg.Mailer")
objNewMail.FromName = FromName
objNewMail.FromAddress = FromEmail
' the mail server goes below
objNewMail.RemoteHost = MailServer
objNewMail.AddRecipient toemail
objNewMail.Subject = Subject
objNewMail.BodyText = message
SendOk = objNewMail.SendMail

case "cdonts"
Set objNewMail = Server.CreateObject ("CDONTS.NewMail")
objNewMail.BodyFormat = 1
objNewMail.MailFormat = 0
'on error resume next '## Ignore Errors
objNewMail.Send FromEmail, YourEmail, Subject, message

case "jmail"
set objNewMail = server.createobject("JMail.SMTPMail")
objNewMail.Sender = FromEmail
objNewMail.ServerAddress = MailServer
objNewMail.AddRecipient toemail
objNewMail.Subject = Subject
objNewMail.Body = message
objNewMail.execute

case "ASPEmail"
Set objNewMail = CreateObject("Persits.MailSender")
objNewMail.From = FromEmail
objNewMail.Host = MailServer
objNewMail.AddAddress toemail
objNewMail.Subject = Subject
objNewMail.Body = message
objNewMail.Send

case "OCXmail"
Set objNewMail = Server.CreateObject("ASPMail.ASPMailCtrl.1")
SendEmail = objNewMail.SendMail(MailServer, YourEmail, FromEmail, Subject, message)
Set objNewMail = Nothing
end select


if (err)then
on error goto 0
SendMail = false
else
on error goto 0
SendMail = true
end if
end function

function SendEmail(fromemail, toemail, subject, message)
Dim ObjSendMail
Set ObjSendMail = CreateObject("CDO.Message")

'This section provides the configuration information for the remote SMTP server.
ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2 'Send the message using the network (SMTP over the network).
ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserver") ="smtp.gmail.com"
ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 465
ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = true 'Use SSL for the connection (True or False)
ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 60

' If your server requires outgoing authentication uncomment the lines bleow and use a valid email address and password.
ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1 'basic (clear-text) authentication
ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusername") ="mail@gmail.com"
ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendpassword") ="proj"

ObjSendMail.Configuration.Fields.Update

'End remote SMTP server configuration section==

ObjSendMail.To = toemail
ObjSendMail.Subject = subject
ObjSendMail.From = "mail01@gmail.com"
ObjSendMail.HtmlBody = message
ObjSendMail.Send
Set ObjSendMail = Nothing
if (err)then
SendEmail = false
else
SendEmail = true
end if
end function

%>

Can anyone help me out here pls?




coreybryant -> RE: Transport failed to connect to server (9/25/2008 10:10:00)

Are you wanting to use CDOSYS, ASPMail, JMail, OCXMa, etc? In most cases, one of these will suffice. You might check out Processing the Form with the JMail EMail Component if you want to use JMail. And don't forget, you will need an email server to help process the form.




pratyusha -> RE: Transport failed to connect to server (9/25/2008 12:02:35)

Hi
Thanks for the advice but I still don't know how to fix the issue. I havent written this code...I just have to fix it.
Can you pls help me out?




TexasWebDevelopers -> RE: Transport failed to connect to server (9/25/2008 15:01:00)

The CDOSYS code you are using sends an email using the gmail smtp over a secure socket layer connection. You need to change these settings to reference your own local server if you want it to work locally. Why bother? If it works on the live server why do you need to have it work locally?




pratyusha -> RE: Transport failed to connect to server (9/25/2008 17:20:51)

I am sorry, it is vice versa... The code is working on the staging site and not on the live site.
Can you let me know what is wrong here?
I have changed the username n password while posting




TexasWebDevelopers -> RE: Transport failed to connect to server (9/25/2008 18:17:42)

You need to set the Configuration.Fields to the correct smtp server name and port for your web site--generally start with something like this:

ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2 'Send the message using the network (SMTP over the network).
ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserver") ="mail.yoursite.com"
ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = False 'Use SSL for the connection (True or False)




Page: [1]

Valid CSS!




Forum Software © ASPPlayground.NET Advanced Edition 2.4.5 ANSI
0.109375