473,385 Members | 1,320 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Sending mails using ASP

18
Hi all,

I am tryin to send a mail using ASP through my webpage.
There are many web-pages that give code which looks like given below...

<%
Set myMail=CreateObject("CDO.Message")
myMail.Subject="Sending email with CDO"
myMail.From="mymail@mydomain.com"
myMail.To="someone@somedomain.com"
myMail.TextBody="This is a message."
myMail.Send
set myMail=nothing
%>
from the code its obvious that we need to modify it with our mail IDs for verification purposes. I did so but still it doesnt seem to work...are their any SMTP related issues in this ? Please guide me to make this code work.

One question more....how can we send e-mails from any mail-id without requiring its password ?
Feb 2 '09 #1
8 2626
semomaniz
210 Expert 100+
I believe that you need to set the configuration for the email to be sent.

here is the example

Expand|Select|Wrap|Line Numbers
  1.  Set objMail = Server.CreateObject("CDO.Message")
  2.  Set objConfig = Server.CreateObject("CDO.Configuration")
  3.  
  4.   objConfig.Fields("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
  5.   objConfig.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "*****"  'here you will be using the smpt server address
  6.   objConfig.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 4   ' here you will use the smpt server port number 
  7.   objConfig.Fields.Update
  8.   set objMail.Configuration = objConfig
  9.  
  10.   objMail.Subject="Test"
  11.   objMail.From="example@example.com"
  12.   objMail.To="example@example.com"  
  13.   objMail.HTMLBody=" This is a test "
  14.   objMail.Send
  15.  
  16.  
  17.  
first you need to find the smtp address, and the port number that is being used by email client on the server. Usually you can get help from the hosting company on this they can provide you with the smtp address and the port info.
Feb 4 '09 #2
jhardman
3,406 Expert 2GB
@theaj
If there was an easy way to send emails it would be exploited by spammers. Unfortunately, that makes it more difficult for legitimate programmers to do their job.

You may rest assured that I would delete any post that explained a way to send from any email ID without requiring authentication, and I would ban any user offering that code.

Jared, moderator
classic ASP forum, Bytes.com
Feb 4 '09 #3
theaj
18
@jhardman

Excuse me...but you took me in the wrong sense...my question was more like...

"I wonder how can this be possible to send emails without requiring any password ?"

As this code showed, I thought this code does so. I too know that this is not legal and ethical too.
Feb 5 '09 #4
theaj
18
@semomaniz

Thanks for the response semomaniz.

Please tell me what kind of this mail will be ? I am asking so because, would it not require a permission (a password in this case) from the sender ?

(Moderators please don't see this question as if I am seeking any such hacking kind of code. All I want to know is the mechanism of sending mails using ASP)

And what you meant by Hosting Company ?
Feb 5 '09 #5
jhardman
3,406 Expert 2GB
@theaj
Are you hosting this website from your own PC? If not, the people who maintain the server should let you know the SMTP address and port number you can use. This is also part of the configuration (I don't think I saw those lines in the code semomaniz posted.

When you send the mail it is sent first to the email server at a particular address and communicated at a particular port (this might be considered the first line of security, if you don't know that basic info you won't get any farther). The mail server should then verify that the sending email address has permission to send from that server. I'm not sure if anything else is checked, but certainly there is not usually a need to enter a password.

Jared
Feb 5 '09 #6
semomaniz
210 Expert 100+
you don't require password for the email, for the code that i have posted. The mail server authenticates you automatically. The from email address should be the address that is already created on you mail server. if the email address does not exist in the mail server you wont be able to send the email.
Feb 5 '09 #7
theaj
18
@semomaniz

does that mean I can't test my code unless I host it on an actual website ?
If it is so,is there any way I can test wheather I am getting the desired functionality before actually hosting this facility on website ?

(bear with me if im totally out of context...im new to ASP)
Feb 10 '09 #8
jhardman
3,406 Expert 2GB
@theaj
You need an SMTP server in order to test, and most places that would host a website provide SMTP services as well. You can turn on SMTP from your own IIS, but that's beyond my specialty.

Jared
Feb 10 '09 #9

Sign in to post your reply or Sign up for a free account.

Similar topics

10
by: Stuart Mueller | last post by:
I have an exchange server, that I sometimes use to perform mail shots to clients on our database, these can be upwards of 1000 at a time. As we don't want different clients to see who we are...
3
by: martin smith | last post by:
Here's the scenario. I'm currently using cdosys/asp to send mail to our SMTP server. We use a product called MailFilter to check for SPAM. It doesn't work very well. If MailFilter isn't working...
9
by: savvy | last post by:
i'm trying to compile a simple console application for sending a mail, my main idea is to schedule it to a particular time for sending mails using the windows schedular task lateron. Therefore i...
1
by: Jayakumar | last post by:
HI, I am using System.web.mail class in my application to send mails. I am using SMTP server for the same. I can send mail to the intranet addresses, But when i send mails to Hotmail or other...
7
by: Lau | last post by:
I need to send 1000 emails from an asp.net website. Normally I would use System.Web.Mail.MailMessage() to send thru an SMTP server. But the large amount of emails results in a timeout. My server...
5
by: cashdeskmac | last post by:
I am writing a web application will will be hosted on a few peoples laptops as a local application. It will send e-mails once the user connects to the internet. How can I set up the "Mail.From"...
8
by: Michel Posseth [MCP] | last post by:
Hi does someone has experience with this ?? i have made a lot of apps in the past that were capable of sending e-mails the server i then talked to was a Linux SMTP server and it worked great ...
1
by: gemma.gill | last post by:
Hi There, I have a button on a form within access that sends a verification e- mail. My problem is that these e-mails are sending from individual user accounts rather than a genieric mailbox. ...
3
by: dskinibbyb | last post by:
Hi Everybody, I am sending mail using the new class in .Net 2.0. Here while sending internal mails it is giving me problem. Carriage return, Line feed and Spaces are lost while sending mails....
2
by: srinivaspnv21 | last post by:
hi every one, plz help me out, i have to send mails from my asp.net page.... I have tried a code where mails are going only to gmail users the code is ... namespace: using System.Web.Mail;...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.