473,406 Members | 2,707 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,406 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 2629
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.