Go Back   CodingForums.com > :: Server side development > ASP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 04-24-2012, 09:48 AM   PM User | #1
puneet_pr
New to the CF scene

 
Join Date: Apr 2012
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
puneet_pr is an unknown quantity at this point
Gmail SMTP not working

I have one application which is developed in ASP. But from few days email function not working. Can anyone help me. i am using GMAIL SMTP.

This is the code

Code:
<%
txtBodyT="<table style='background-color:#CCCCCC; border-bottom-color:#CCCCCC; border-bottom-style:solid; border-bottom-width:0px; border-top-color:#CCCCCC; border-top-style:solid; border-top-width:0px; border-left-color:#CCCCCC; border-left-style:solid; border-left-width:40px; border-right-color:#CCCCCC; border-right-style:solid; border-right-width:40px;' width='70%'>"
txtBodyT=txtBodyT&"<tr>"
txtBodyT=txtBodyT&"<td>"
txtBodyT=txtBodyT&html
txtBodyT=txtBodyT&"</td>"
txtBodyT=txtBodyT&"</tr>"
txtBodyT=txtBodyT&"</table>"
subjectM="DIAL HR Apply for "& txtTotalApply &" "&txtLeaveType'"Test Send mail from localhost"
Set objMessage = CreateObject("CDO.Message") 
objMessage.Subject = subjectM
objMessage.From = txtFromEmail
objMessage.To = txtNPEMAIL
objMessage.CC = "dialhr2011@gmail.com"
'objMessage.BCC = "puneet.rawat@gdfsuez.com" 
objMessage.HTMLBody  = txtBodyT
'objMessage.TextBody = html'"This is some sample message text."

'==This section provides the configuration information for the remote SMTP server.

objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2

'Name or IP of Remote SMTP Server
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "smtp.gmail.com" 'dbserver1.tractebel.net.in smtp.gmail.com

'Type of authentication, NONE, Basic (Base64 encoded), NTLM
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1

'Your UserID on the SMTP server
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/sendusername") = "myid@gmail.com"

'Your password on the SMTP server
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "password"'---------password

'Server port (typically 25)
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 465

'Use SSL for the connection (False or True)
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = 1 'false'1

'Connection Timeout in seconds (the maximum time CDO will try to establish a connection to the SMTP server)
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 60

If intSendUsing = 1 Then
	'objMessage.Configuration.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserverpickupdirectory") = "c:\inetpub\mailroot\pickup" 
End If

objMessage.Configuration.Fields.Update

'==End remote SMTP server configuration section==
on error resume next
objMessage.Send
if err<>0 then
	'Response.Write(err.File&"<br />")
	Response.Write(err.Number&"<br />")
	Response.Write(err.Description&"<br />")
	Response.Write(err.Source&"<br />")
else
	Response.Write("<br />Message Send... :)<br/>" & txtBodyT)
end if
	Response.Write("<br />Message Send... :)<br/>" & txtBodyT)
%>
Please help me..
puneet_pr is offline   Reply With Quote
Old 04-24-2012, 08:27 PM   PM User | #2
Old Pedant
Supreme Master coder!

 
Old Pedant's Avatar
 
Join Date: Feb 2009
Posts: 23,248
Thanks: 59
Thanked 3,999 Times in 3,968 Posts
Old Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to all
Think you might have to ask Google, or ask in the google forums.

Your code looks right to me. But I don't use GMail SMTP.
__________________
An optimist sees the glass as half full.
A pessimist sees the glass as half empty.
A realist drinks it no matter how much there is.
Old Pedant is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 05:52 PM.


Advertisement
Log in to turn off these ads.