If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > ASP > How to send email to mobile..

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 08-24-04, 15:27
RhythmAddict RhythmAddict is offline
Registered User
 
Join Date: Dec 2003
Posts: 148
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" 
%>
Reply With Quote
  #2 (permalink)  
Old 08-24-04, 16:33
Seppuku Seppuku is offline
Useless...
 
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.
Reply With Quote
  #3 (permalink)  
Old 08-24-04, 16:40
RhythmAddict RhythmAddict is offline
Registered User
 
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?)
Reply With Quote
  #4 (permalink)  
Old 08-24-04, 17:20
Seppuku Seppuku is offline
Useless...
 
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.
Reply With Quote
  #5 (permalink)  
Old 08-24-04, 17:32
RhythmAddict RhythmAddict is offline
Registered User
 
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?
Reply With Quote
  #6 (permalink)  
Old 08-24-04, 19:27
rokslide rokslide is offline
Registered User
 
Join Date: Nov 2003
Location: Christchurch, New Zealand
Posts: 1,617
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
Reply With Quote
  #7 (permalink)  
Old 08-25-04, 09:58
RhythmAddict RhythmAddict is offline
Registered User
 
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...
Reply With Quote
  #8 (permalink)  
Old 08-25-04, 17:00
RhythmAddict RhythmAddict is offline
Registered User
 
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
%>
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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
Trackbacks are On
Pingbacks are On
Refbacks are On