send email part1

Hi experts, how to start coding to develop email to send someone else? I have codes below but I do not know how to do next. Thank you!

<!DOCTYPE html>
<html>
<body>
<h2>Send e-mail</h2>
<form>
Name:<br>
<input type="text" name="name"><br>
E-mail:<br>
<input type="text" name="mail"><br>
Comment:<br>
<input type="text" name="comment" size="50"><br><br>
From:<br>
<input type="text" name="Sender" value="hobbit@yahoo.com"><br>
<input type="submit" value="Send">
<input type="reset" value="Reset">
</form>

</body>
</html>
Whing Dela CruzAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Ryan ChongBusiness Systems Analyst , ex-Senior Application EngineerCommented:
you can try use CDOSYS to do that. it should allow you to configure the SMTP details when necessary.

For more info:

ASP Sending e-mail with CDOSYS
https://www.w3schools.com/asp/asp_send_email.asp
0
Whing Dela CruzAuthor Commented:
Hi experts, I tried to use this code as shown below base on Chong suggested above formula, but found no result at all. I've got not error but when I check the recipient mail, I found nothing. I run this code to server side asp and when I execute it a Response.Write is responding. Am I doing in a right way or this is totally wrong? any guide please. Thank you!
 
<%
Set myMail = CreateObject("CDO.Message")
myMail.Subject = "Sending email with CDO"
myMail.From = "hobbitdelacruz@yahoo.com"
myMail.To = "niwre@yahoo.com"
myMail.TextBody = "This is a message."
myMail.Send
set myMail = nothing
Response.Write "Successfully sent!"
%>
0
Ryan ChongBusiness Systems Analyst , ex-Senior Application EngineerCommented:
you may need to configure the SMTP details before you sending the email out.

you can refer to the answer of this question:

https://www.experts-exchange.com/questions/24535297/CDOSYS-Sending-to-Yahoo-Moved-to-Spam-Folder.html

with following yahoo mail settings:

Yahoo SMTP configuration
http://www.serversmtp.com/en/smtp-yahoo
0
Determine the Perfect Price for Your IT Services

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden with our free interactive tool and use it to determine the right price for your IT services. Download your free eBook now!

Whing Dela CruzAuthor Commented:
Hi experts, I can able to run the code as shown below after fixing smtp. However, my recipient still can't receive the email after sending it base on the code below. The code has no error. What should I do next?

<%
Set myMail = CreateObject("CDO.Message")
myMail.Subject = "Sending email with CDO"
myMail.From = "hobbitdelacruz@yahoo.com"
myMail.To = "niwre@yahoo.com"
myMail.TextBody = "This is a message."
myMail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
'Name or IP of remote SMTP server
myMail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "118.91.12.75"
'Server port
myMail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
myMail.Configuration.Fields.Update
myMail.Send
set myMail = nothing
Response.Write "Successfully sent!"
%>
0
Whing Dela CruzAuthor Commented:
Hello Experts, When I run the code shown above no error appeared, but SMPT error goes directly to Badmail. The specific error code was 0xC00402C7. Is there anyone who can help me which part of my server needs to fix? I am using iis v5.1 and my Default SMPT has already set-up. Thank you!
0
Ryan ChongBusiness Systems Analyst , ex-Senior Application EngineerCommented:
so you wish to send out emails via default SMTP setting in IIS OR via a SMTP setting just like your email (your own domain email, yahoo, etc) ?
0
Whing Dela CruzAuthor Commented:
HI Chong, I actually can't differentiate among the two options, but I guest via dafault SMTP setting in IIS is good for me since I have already setting up them on my server pc.
0
Ryan ChongBusiness Systems Analyst , ex-Senior Application EngineerCommented:
check this article, especially in the section: Configure SMTP E-Mail for a Web Application

Configure SMTP E-Mail in IIS 7
https://www.iis.net/learn/application-frameworks/install-and-configure-php-on-iis/configure-smtp-e-mail-in-iis-7-and-above

Or you can try to configure using custom SMTP setting, like gmail

Email To Gmail Using Access VBA
http://www.blueclaw-db.com/access_email_gmail.htm

i tried this and it works for me (example using Gmail) :

<%

send = true
msg = ""

if request.form <> "" then
    if request("name") = "" then
        send = false
        msg = msg & "Receiver's name is required<br>"
    end if
    if request("mail") = "" then
        send = false
        msg =  msg & "Receiver's email address is required<br>"
    end if
    if request("comment") = "" then
        send = false
        msg =  msg & "Email's comment is required<br>"
    end if
    if request("Sender") = "" then
        send = false
        msg =  msg & "Sender's email address is required<br>"
    end if
else
    send = false
end if

if send = true then
    
    Set myMail = CreateObject("CDO.Message")
    myMail.Subject = "Sending email with CDO"
    myMail.From = request("Sender")
    myMail.To = request("mail")
    myMail.TextBody = request("comment")

    myMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
    myMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "smtp.gmail.com"
    myMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 465

    myMail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = True
    myMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1
    myMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusername") = "yourGmail@gmail.com"
    myMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "yourPassword"

    myMail.Configuration.Fields.Update
    myMail.Send
    set myMail = nothing

    response.write "Email was sent out"
else
    response.write msg
end if

%>

<!DOCTYPE html>
<html>
<body>
<h2>Send e-mail</h2>
<form method="post">
Name:<br>
<input type="text" name="name" value="<%=Server.HTMLEncode(request("name"))%>" /><br>
E-mail:<br>
<input type="text" name="mail" value="<%=Server.HTMLEncode(request("mail"))%>" /><br>
Comment:<br>
<input type="text" name="comment" size="50" value="<%=Server.HTMLEncode(request("comment"))%>" /><br><br>
From:<br>
<input type="text" name="Sender" value="hobbit@yahoo.com"><br>
<input type="submit" value="Send">
<input type="reset" value="Reset">
</form>

</body>
</html> 

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Whing Dela CruzAuthor Commented:
Thank you so much Chong, It's working. Now, I'm so happy that I can send email. Thanks for providing me such codes. More power and God bless!
1
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
HTML

From novice to tech pro — start learning today.