Results 1 to 8 of 8
  1. #1
    Join Date
    Dec 2003
    Posts
    148

    Unanswered: How to send email to mobile..

    Hi all....I have a page that sends email to an inbox if there are Database results. Cool, works as planned....I want to send them to my Mobile phone, via its mobile email address. I CAN send email to my mobile phone from say, outlook (or any email) client and I receive it quickly, without issue. I cannot figure out why I can do that, but yet when I use my ASP code, it does not work. Has anyone sent mail to their mobile email address using ASP successfully? If so, I'd love to know how...

    My code is very simple (and works when I send to a "normal" email address) Here it is for reference:

    Code:
    <% 
    Response.Expires = 0 
    Dim message_body 
    message_body = "test email"& vbCrlf 
    Set ObjMail = Server.CreateObject("CDONTS.NewMail") 
    objMail.To = "1111111@carrier.com" 
    objMail.Subject ="Test Email" 
    objMail.From = "email@address.com" 
    objMail.Body = message_body 
    ObjMail.Send 
    Set ObjMail = Nothing 
    Response.Write"sent" 
    %>

  2. #2
    Join Date
    Jul 2003
    Location
    SoCal
    Posts
    721
    It sounds like your email server may not be configured properly. Do you manage the email server?
    That which does not kill me postpones the inevitable.

  3. #3
    Join Date
    Dec 2003
    Posts
    148
    Unfortunately, I do not manage the email server... :-/

    Do you have any idea what might be wrong with it? Also, how does your ASP know what server to use? (ie, can i try this at home? where i do not have a server?)

  4. #4
    Join Date
    Jul 2003
    Location
    SoCal
    Posts
    721
    CDONTS has to have an email profile associated with it. That email profile specifies the email server to use. I'm assuming that if you're able to send an email from CDONTS to a normal mail accounts, that profile is setup ok.
    That which does not kill me postpones the inevitable.

  5. #5
    Join Date
    Dec 2003
    Posts
    148
    That's the real kicker here...I can send mail with CDONTS to my normal email. I can send email from my PCs mail client to my mobile phone.
    When I combine the two; try to send email with CDONTS to my mobile phone I get nothing.

    Do you think its my mobile phone carrier? Is that even really possible?

  6. #6
    Join Date
    Nov 2003
    Location
    Christchurch, New Zealand
    Posts
    1,618
    Let me ask a quick question...

    When CDONTS sends to your email address (not the phone) is it an internal email address??

    If it is then it is likely that while outlook has permissions to send emails anywhere, CDONTS only has permissions to send to the internal network. This is often done to prevent spamming.

    You should (in theory) be able to get past this by fully authenicating with the SMTP server as a valid user.

    HTH

  7. #7
    Join Date
    Dec 2003
    Posts
    148

    That is a very...

    Good question. I just tried it out and I did NOT receive an email to my external address...That has to be it.

    How would I go about fully authenticating with the SMTP server?? Time for another twist - this is actually a WSH/VBS script, not an ASP page...

  8. #8
    Join Date
    Dec 2003
    Posts
    148

    Just in case anyone needs to know...

    This is now solved. Rokslide was on point. CDONTs not permitted to send external email because you basically are not authenticating to the exchange server. The way around this is to use CDO (I could not find any documentation anywhere, and there do not think you can authenticate using CDONTS ie, CDO vs CDO NT)
    Anyway..this is the code:

    Code:
    <%
    Const cdoSendUsingMethod        = _
    	"http://schemas.microsoft.com/cdo/configuration/sendusing"
    Const cdoSendUsingPort          = 2
    Const cdoSMTPServer             = _
    	"http://schemas.microsoft.com/cdo/configuration/smtpserver"
    Const cdoSMTPServerPort         = _
    	"http://schemas.microsoft.com/cdo/configuration/smtpserverport"
    Const cdoSMTPConnectionTimeout  = _
    	"http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout"
    Const cdoSMTPAuthenticate       = _
    	"http://schemas.microsoft.com/cdo/configuration/smtpauthenticate"
    Const cdoBasic                  = 1
    Const cdoSendUserName           = _
    	"http://schemas.microsoft.com/cdo/configuration/sendusername"
    Const cdoSendPassword           = _
    	"http://schemas.microsoft.com/cdo/configuration/sendpassword"
    
    Dim objConfig  ' As CDO.Configuration
    Dim objMessage ' As CDO.Message
    Dim Fields     ' As ADODB.Fields
    
    ' Get a handle on the config object and it's fields
    Set objConfig = Server.CreateObject("CDO.Configuration")
    Set Fields = objConfig.Fields
    
    ' Set config fields we care about
    With Fields
    	.Item(cdoSendUsingMethod)       = cdoSendUsingPort
    	.Item(cdoSMTPServer)            = "your.smtp.server"
    	.Item(cdoSMTPServerPort)        = 25
    	.Item(cdoSMTPConnectionTimeout) = 10
    	.Item(cdoSMTPAuthenticate)      = cdoBasic
    	.Item(cdoSendUserName)          = "username"
    	.Item(cdoSendPassword)          = "password"
    
    	.Update
    End With
    
    Set objMessage = Server.CreateObject("CDO.Message")
    
    Set objMessage.Configuration = objConfig
     
    With objMessage
    	.To       = "external@emailaddress.com"
    	.From     = "Valid@internaladdrses.com"
    	.Subject  = "SMTP Relay Test"
    	.TextBody = "SMTP Relay Test Sent @ " & Now()
    	.Send
    End With
    response.write "sent"
    Set Fields = Nothing
    Set objMessage = Nothing
    Set objConfig = Nothing
    %>

Posting Permissions

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