473,756 Members | 6,250 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Sending mails using ASP

18 New Member
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=CreateOb ject("CDO.Messa ge")
myMail.Subject= "Sending email with CDO"
myMail.From="my mail@mydomain.c om"
myMail.To="some one@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 2644
semomaniz
210 Recognized Expert New Member
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 Recognized Expert Specialist
@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 New Member
@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 New Member
@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 Recognized Expert Specialist
@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 Recognized Expert New Member
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 New Member
@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 Recognized Expert Specialist
@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
4987
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 working with we put these mailshots in the bcc field of the mails. This can sometimes cause a problem as we are getting alot of mails bounced back. I would like to write a script to have these emails sent out individually using the to: field of the...
3
6269
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 cdosys also has problems and emails don't get sent. As these email are confirmations for customer's bookings this means lots of customers calling to see where their confirmation emails have gone. The root of the problem is MailFilter but that here...
9
3281
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 need an exe file to make that work. I compiled my file Emailtest.cs using this command line csc /r:System.Web.dll Emailtest.cs and i got an .exe file but when clicking it or executing it i'm not receiving any mail. I dont know where the problem is...
1
1767
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 domains the mails are not sent. What should i do for the sending mails to hotmail and other accounts. (But if i have send mails to hotmail from my acount then i can send mails. ) Kindly reply for my problems.
7
3521
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 administrator told me to write the emails to the “pickup directory” instead. I know that JMail can do this in ASP, but how do you do this in asp.net? -- --------------------
5
1529
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" field if I don't know the address of the user's laptop? I have managed to get it working on my own machine, but setting the "From" filed to "Localhost" doesn't seem to work. Any suggestions?
8
2848
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 Now i work in a company with a MS exchange server and would like to send some e-mails however i can`t get it to work at all error is : ( translated form the dutch language )
1
2155
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. Is there a way to do this? We are using MS Outlook each user has an account set up that gives them a personal mailbox and access to another mailbox "helpdesk". I
3
2381
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. I am using msg.BodyEncoding = System.Text.UTF8Encoding.UTF8 to encode the body. But same code and same mail is going fine , when sent to external mails (Like gmail, yahoo, etc.) Please can anyone help me in solving my problem. I even tried...
2
1389
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; protected void btnSend_Click(object sender, EventArgs e) {
0
9303
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, well explore What is ONU, What Is Router, ONU & Routers main usage, and What is the difference between ONU and Router. Lets take a closer look ! Part I. Meaning of...
0
9117
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
9676
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
6390
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4955
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5156
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3651
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3141
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2508
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.