Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Apr 2012
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    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..

  • #2
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    26,725
    Thanks
    80
    Thanked 4,515 Times in 4,479 Posts
    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.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •