获取本机IPv6地址 发送邮箱

SendIPv6AddressToEmail.ps1


$IPv6 = (Get-NetIPAddress -AddressFamily ipv6  -prefixorigin routeradvertisement ).IPAddress

$IPv6_Address = $IPv6[0]+"`n"+$IPv6[1]

$password = ConvertTo-SecureString "此处为我的邮箱的授权码" -AsPlainText -Force
$userpassword = New-Object PSCredential('[email protected]', $password)

Send-MailMessage -To "[email protected]" -From "[email protected]" -SMTPServer 'smtp.mail.com' -Port 587 -Subject "The Current IPv6 Address" -Body $IPv6_Address -Credential $userpassword

你可能感兴趣的:(获取本机IPv6地址 发送邮箱)