I send mail from smpt.gmail.com and the reply name is different from gmail.com account.
Example
-----------
user : dutchez@gmail.com
pass : 12345678
display : EASYFO Hotel
reply : dutchez@easyfohotel.com
- Code: Select all Expand view RUN
- TRY
oEmailCfg := CREATEOBJECT( "CDO.Configuration" )
WITH OBJECT oEmailCfg:Fields
:Item( "http://schemas.microsoft.com/cdo/configuration/smtpserver" ):Value := cSmtp // "smtp.gmail.com"
:Item( "http://schemas.microsoft.com/cdo/configuration/smtpserverport" ):Value := iif(lSSL,465,25)
:Item( "http://schemas.microsoft.com/cdo/configuration/sendusing" ):Value := 2 // Remote SMTP = 2, local = 1
:Item( "http://schemas.microsoft.com/cdo/configuration/smtpauthenticate" ):Value := lAuthen // .T.
:Item( "http://schemas.microsoft.com/cdo/configuration/smtpusessl" ):Value := lSSL // .T.
:Item( "http://schemas.microsoft.com/cdo/configuration/savesentitems" ):Value := lSave
:Item( "http://schemas.microsoft.com/cdo/configuration/sendusername" ):Value := cSender // "hotel@gmail.com"
:Item( "http://schemas.microsoft.com/cdo/configuration/sendpassword" ):Value := cPass // Password
:Item( "http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout"):Value := 20
:Update()
END WITH
CATCH oError
MsgAlert("Could not setting message" + CRLF+ ;
"Error : " + TRANSFORM(oError:GenCode, NIL) + ";" + CRLF+;
"SubCode : " + TRANSFORM(oError:SubCode, NIL) + ";" + CRLF+ ;
"OSCode : "+ TRANSFORM(oError:OsCode, NIL) + ";" + CRLF +;
"SubSystem : " + TRANSFORM(oError:SubSystem, NIL) + ";" +CRLF+ ;
"Message : " + oError:Description )
END
oError:=NIL
cDisplay := "EASYFO Hotel"
cReply := "dutchez@easyfohotel.com"
TRY
oEmailMsg := CREATEOBJECT ( "CDO.Message" )
WITH OBJECT oEmailMsg
:Configuration := oEmailCfg
:From := chr(34)+cDisplay+" "+chr(34)+ "<"+cReply+">" // This will be displayed in the From (The email id does not appear)
:To := cTo // "customers@hotmail.com" // <----- Place your email address
:Subject := rtrim(cSubject) // "Email Test Message from GMail"
:ReplyTo := cReply
:MDNRequested := .F.
if !empty(cAttach)
:AddAttachment(cAttach)
end
:HTMLBody = cHtml
END WITH
oEmailMsg:Send()
CATCH oError
MsgStop("Could not send message" + CRLF+ ;
"Error : " + TRANSFORM(oError:GenCode, NIL) + CRLF+;
"SubCode : " + TRANSFORM(oError:SubCode, NIL) + CRLF+ ;
"OSCode : "+ TRANSFORM(oError:OsCode, NIL) + CRLF +;
"SubSystem : " + TRANSFORM(oError:SubSystem, NIL) + CRLF+ ;
"Message : " + oError:Description )
END
I need to show in mail header as below;
EASYFO Hotel <dutchez@easyfohotel.com>
But it show
EASYFO Hotel <dutchez@gmail.com>
The reply name show correctly ( "dutchez@easyfohotel.com" ), when reply mail.
How can I change email header?