PC SOFT

FOROS PROFESIONALES
WINDEVWEBDEV y WINDEV Mobile

Inicio → WEBDEV 2024 → Email Sender versus Recepient
Email Sender versus Recepient
Iniciado por John, 16,oct. 2023 03:26 - 4 respuestas
Publicado el 16,octubre 2023 - 03:26
I want the user to send me a registration email. My form is set up so the user inputs their emaill address in the EDT_Sender field. (My email address is set in the gsEmailUser global field.)

The problem I have is that if they are not the same an error is generated stating that "Last response of the SMTP server: <xxx.xxx.xxx Error: no valid recipients." (And of course, if the Recipient is not my real email address, the send goes into never/never land.)

I'd like the email to show "From: xxx.xxx.org (EDT_Sender field)," and "To: my email address (gsEmailUser)."

Current work around is to add a "Sent By:" line in the message and live with the From/To blocks being my email address.'

Am I using the wrong WLanguage to send this type of email? Any suggestions?

My code:

IF EmailStartSMTPSession(gsEmailUser, gsEmailPassword, gsEmailServer, gnEmailPort, False, emailProtocolSMTPS) = True THEN
//IF EmailStartSMTPSession(sSendTo, sPassword, sSMTP, 587, False, emailOptionSecuredTLS) = True THEN
Email.Sender = gsEmailUser //EDT_Sender
Email.Recipient = gsEmailUser
Email.Subject = "Registration " + DateSys() + " - " + TimeSys()
Email.Message = ""
Email.Message += "Sent By: " + EDT_Sender + CR
Email.Message += "Last Name: " + EDT_Last_Name + CR
Email.Message += "First Name: " + EDT_First_Name + CR
Email.Message += "Login/UserID: " + EDT_LoginUserID + CR
Email.Message += "Password: " + EDT_Password
Email.NbRecipient = 1
Email.NbAttach = 0
Email.Bcc = ""
Email.NbBcc = 0
// Sends the email
IF EmailSendMessage(gsEmailUser) = False THEN
Error()
ELSE
Info ("Registration information was sent...Expect a reply shortly.")
END
EmailCloseSession(gsEmailUser)
ELSE
Info ("Could not send the email...Error: " + ErrorInfo())
END
Miembro registrado
118 mensajes
Publicado el 17,octubre 2023 - 12:15
Email.Recipient is an array, so use
Email.Recipient.Add(gsEmailUser)
Publicado el 18,octubre 2023 - 01:24
Meikl,

Thank you, but that doesn't work...generates an error that ".Add is unknown for this element."
Also, my issue is that the Email.Sender causes an error, not the Recepient.

If the Email.Sender does not equal my email address (same as Recipient/gsEmailUser) the send fails.

It's as if I can only email myself if "myself" is also the Sender?

I want the "remote" user to enter their email address and send the note to me.
Miembro registrado
118 mensajes
Publicado el 19,octubre 2023 - 14:06
Depends on the Version you use, if you use an older Version the syntax is
Add(Email.Recipient,gsEmailUser )
Publicado el 28,octubre 2023 - 03:01
Meikl,

Doesn't work...perhaps it's my explanation; what I want is to enter one or more "senders," (the person using my application) not multiple recipients.

Using the code I show, the email only sends when both sender and recipient are set to the same address; in my case both set to my address.

When I ask the user to enter their email, remarks, etc. errors are generated that the server doesn't know the recipient...my email address...if both sender and recipient are my email address...goes through as expected. (I also tried "reversing" the sender and recipient, but that causes errors also.)

I must not understand the SMTP setup or am using the wrong one to start the session, but I don't understand what to do.