Hi-
I hope someone has a suggestion for me.
I'm using the "sendemail" function in XBasic to send confirmation e-mails when the user clicks a button, after adding a record. It works great (see code below)!
However, I want to change the "Display" name for the sender, because I'm sending all of the e-mails from the same SMTP box (SSL with Authentication). So, if you look at the code below, ALL e-mails will show that they came from "[email protected]". BUT, I want them to appear to come from the Trainer's e-mail or a display name (e.g. Phil Samuels), which would be a field in the current record (I hope that makes sense).
If I make the "from" = "[email protected]" (the owner of the e-mail SMTP mailbox), it's flawless. If I change "from" to anything else, it does not send (NOTE: I don't change the "user" name... just the "from" name. Is there any way to use an "alias" or another e-mail address ("reply to"? Maybe) that would still allow the message to send (of course, I'd keep the "user" name unchanged)? I suspect there are other fields available other than "from", "to","subject", "html_message", etc. I just don't know what other options exist for this function or where to find the documentation.
I'd appreciate any suggestions.
Thanks,
Phil
function sendEmail as c (e as p)
'This function will handle the Ajax callback.
dim pm as P
dim ps as P
dim from as C
dim user as C = "[email protected]"
dim emailpwd as C = "myfakepassword"
dim subject as C = "Scheduled In-Store Training: Pre-class Actvities"
dim body as C
'from = e._CurrentRowDataNew.Trainer_email
from = "[email protected]"
body = "Attn. Manager <br><br>"
body = body + "Please reply to this email for all inquiries or send your request to " + from<br><br>"
body = body + "Thank you,<br>"
body = body + "Training Program System"
'sendEmailRes = email_send_gmail(user,emailpwd,cTo,from,subject,body,"")
IF (email_smtp_open(ps, "mail.yigcomputers.com",465,user,emailpwd,"SSL")) THEN
With pm
.to = "[email protected]"
.from = from
.cc = ""
.bcc = ""
.subject = subject
.html_message = body
.charset = "utf8"
.autowrap = .T.
End With
sendEmailRes = email_smtp_send(pm, ps)
END IF
email_smtp_close(ps)
I hope someone has a suggestion for me.
I'm using the "sendemail" function in XBasic to send confirmation e-mails when the user clicks a button, after adding a record. It works great (see code below)!
However, I want to change the "Display" name for the sender, because I'm sending all of the e-mails from the same SMTP box (SSL with Authentication). So, if you look at the code below, ALL e-mails will show that they came from "[email protected]". BUT, I want them to appear to come from the Trainer's e-mail or a display name (e.g. Phil Samuels), which would be a field in the current record (I hope that makes sense).
If I make the "from" = "[email protected]" (the owner of the e-mail SMTP mailbox), it's flawless. If I change "from" to anything else, it does not send (NOTE: I don't change the "user" name... just the "from" name. Is there any way to use an "alias" or another e-mail address ("reply to"? Maybe) that would still allow the message to send (of course, I'd keep the "user" name unchanged)? I suspect there are other fields available other than "from", "to","subject", "html_message", etc. I just don't know what other options exist for this function or where to find the documentation.
I'd appreciate any suggestions.
Thanks,
Phil
function sendEmail as c (e as p)
'This function will handle the Ajax callback.
dim pm as P
dim ps as P
dim from as C
dim user as C = "[email protected]"
dim emailpwd as C = "myfakepassword"
dim subject as C = "Scheduled In-Store Training: Pre-class Actvities"
dim body as C
'from = e._CurrentRowDataNew.Trainer_email
from = "[email protected]"
body = "Attn. Manager <br><br>"
body = body + "Please reply to this email for all inquiries or send your request to " + from<br><br>"
body = body + "Thank you,<br>"
body = body + "Training Program System"
'sendEmailRes = email_send_gmail(user,emailpwd,cTo,from,subject,body,"")
IF (email_smtp_open(ps, "mail.yigcomputers.com",465,user,emailpwd,"SSL")) THEN
With pm
.to = "[email protected]"
.from = from
.cc = ""
.bcc = ""
.subject = subject
.html_message = body
.charset = "utf8"
.autowrap = .T.
End With
sendEmailRes = email_smtp_send(pm, ps)
END IF
email_smtp_close(ps)
Comment