We help IT Professionals succeed at work.

send email part1

Whing Dela Cruz
on
209 Views
Last Modified: 2017-03-21
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>
Comment
Watch Question

CERTIFIED EXPERT

Commented:
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

Author

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!"
%>
CERTIFIED EXPERT

Commented:
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

Author

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!"
%>

Author

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!
CERTIFIED EXPERT

Commented:
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) ?

Author

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.
CERTIFIED EXPERT
Commented:
This problem has been solved!
(Unlock this solution with a 7-day Free Trial)
UNLOCK SOLUTION

Author

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!